// Arup Guha
// 3/18/02
// A quick example to show how nested try clauses work.
#include <iostream.h>

char msg[10] = "too big";

int fact(int n) {
  if (n < 0) throw (n);
  else if (n>10) throw (msg);
  else if (n==0) return 1;
  else return n*fact(n-1);
}

main() {

  try {

    cout << "Inside first try block" << endl;

    try {
      cout << "Factorial of 3 is " << fact(3) << endl;
      cout << fact(11) << endl;
    }
    catch(int n) {
      cout << "neg" << endl;
    }

    cout << "Should not get here." << endl;

  }
  catch (char *m) {
    cout << m << endl;
  }

  cout << "But this should be printed." << endl;
}
