+ 4
what is the difference between cout, cerr and clog
4 Respuestas
+ 4
cout : Regular output
cerr - Error output
clog - Nobody cares (just a classic console log)
+ 10
#include<iostream>
#include<exception>
int main()
{
try
{
//User's code here
//eg
// int a;
// cin>>a;
// cout<< a/0 <<endl;
//Obviously error generating...
}
catch(exception& e)
{
cerr<<"Some Unexpected Error Occured. "<<e.what()<<endl;
//This will write this message along with the error
//name in the standard error handling stream...
}
}
+ 2
can u give example of cerr
+ 1
thanks @kinshuk