Try and read an integer. Then call cin.fail(). If it returns true, then it didn't work.

Run the code, see what it does, look in a debugger. It's very simple