#include #include "Foo.H" using namespace std; const int SENTINAL = 0; int main () { int num; Foo foo = Foo(); cout << "Enter a positive number (" << SENTINAL << " to exit): " ; cin >> num; while ( num != SENTINAL ) { try { foo.setNum(num); // setNum might throw an exception cout << "Success - foo.num = " << foo.getNum() << endl; } catch (IllegalArgumentException) { cerr << "Failure - caught IllegalArgumentException" << endl; } cout << "Enter a positive number (" << SENTINAL << " to exit): " ; cin >> num; } return EXIT_SUCCESS; }