 <p>Based on the error message you print, I'm guessing your problem is that you want to give the user a chance to try again to enter a number, but after one failure, it continuously fails no matter what you enter. If that's the case, replace your <code>break</code> with <code>cin.clear()</code>. That will tell the stream that you've recovered from the error and are ready to receive more input.</p> <p>If you're going to do that, though, your program now has no exit condition, so you'll want to add a <code>break</code> (or <code>return 0</code>) just after the for-loop.</p>