I receive the "Should not output this" output even when exception occurs in the cin >> foo statement.
Why doesn't return(0) work as I'm assuming it to work and what's the right way of doing it?
Peter87 is right, it looks like an exception isn't ever being thrown.
For debugging purposes, try adding in a
cout << foo;
right after you try to read foo in. This will let you know if an error is occurring or if your program is reading in something that you aren't expecting/don't want it to.
In what context are you putting cin in a try block, by the way? That might help us figure out a better way to set this up.