cin throws an exception on bad input, unless you explicitly tell it to do so. In any case, I'm not sure an exception is the best solution, as it adds unnecessary complications to the age-old problem.cin, upon invalid input, sets its failbit to true(1). It's easier to detect cin failure, deal with the bad input and ask for valid input (again).