Every time you use the >> operator the program is waiting for you to hit enter. The >> operator also stops reading at white space.
Your program starts waiting at line 23, reads the string and gives an error message (since you can pretty much count on that statement evaluating to true). The program waits at line 27 for you to enter a number. If you do, the program waits at line 29 for you to enter another number.
So you need to only have one >> operation, and change the order a little: