1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include <iostream> #include <string> using namespace std; int main() { try { cout << "inside try\n"; throw "Text"; } catch (char const* x) { cout << "in catch" << x << endl; } cout << "Done with try-catch\n"; }
1 2 3
inside try in catchText Done with try-catch