C++ 中cerr和cout的区别实例详解
前言:
cerrThe object controls unbuffered insertions to the standard error output as a byte stream. Once the object is nstructed, the expression cerr.flags & unitbuf is nonzero.
Example
// iostream_cerr.cpp
// compile with: /
代码如下:#include using namespace std;int hello1();int hello2();
int main() { int a, b; cout<<“a=”<<hello1()<<” b=”<<hello2()<<endl; return 0;}
int hello1(){ cout<<“hello1″<<endl; return 1;}int hel