#include using namespace std; void BadFun1(int n) { cout << "In BadFun1 with N = " << n << endl; switch(n) { case 0: throw 7; case 1: throw "Hello"; case 2: throw string{"Hello"}; default: break; } cout << "Out of BadFun1 " << endl; } void Passthrough(int n, int calls) { cout << "in Passthrough " << endl; if(calls <= 0) { try { BadFun1 (2); } catch (int e) { cout << "In passthrough catch, throwing a string" << endl; throw string{"From Passthroug"}; } } else { Passthrough(n, calls-1); } cout << "Exiting Passthrough" << endl; cout << endl; } int main() { try { cout << "In the try block " << endl; Passthrough(2, 3); cout << "Done with the try block " << endl; } catch (const char * e) { cout << "In the const char * catch, the value is " << e << endl; } catch (string e) { cout << "In the string catch, the value is " << e << endl; } catch (int e) { cout << "In the int cactch and the value is " << e << endl; /*} catch (...) { cout << "In the default catch " << endl; */ } cout << "Exiting the program " << endl; return 0; }