#include "stdafx.h" #include <iostream> using namespace std; class MyProblem :public exception { public: MyProblem() { } virtual const char* what() const throw() { return "There are something wrong!\n"; } }; int _tmain(int argc, _TCHAR* argv[]) { try { if ("Something wrong!") { throw MyProblem(); } } catch(const exception& e) { cerr<<e.what()<<endl; } return 0; }