CS202 5- ‹#›
Nested Try Blocks
n
n  try {           //outer try block
n    cout <<"Enter a character and an integer: ";
n    cin >>c >>i;
n
n    try {         //inner try block
n      if (c != 'x')
n        throw c;  //throw exception of type char
n      if (i != 42)
n        throw i;  //throw exception of type int
n      cout <<"no throw was executed" <<endl;
n    }
n    catch(char) { //inner catch block
n      cout <<"char exception handler called" <<endl;
n    }
n    cout <<"either char exception or no throw" <<endl;
n  }
n  catch(...) {    //outer catch block
n    cout <<"universal exception handler called" <<endl;}
n