#include #include // for set_terminate() #include using namespace std; void uncaught() { cerr << "I wasn't able to catch an exception\n"; } void funk(int i) { try { switch (i) { case 1: throw(string("have a nice day")); case 2: throw(5); case 3: throw(3.14); } } catch(const string& it) { cout << "You threw me a string: " << it << endl; } catch(double it) { cout << "You threw me a double: " << it << endl; } } int main() { set_terminate(uncaught); funk(1); funk(2); funk(3); cout << "End of program\n"; }