I am assuming that if the user enters a 5, you want it to exit the do-while? The problem is in the conditional on your do-while. You have it set to "loop this if answer is equal to 5". I believe you want to change it to not equals? Anyway, if that is true, there is one other thing you need to do, you need to flush the input stream. The easiest way I can think of, I added to the code below. It just consists of cin.clear() and cin.get().