The Standard Structure for a while Loop That Gets Input
The standard structure for a while loop that gets input is:
get input while (input ok) { process ... get input }
If you are prompting the user using a sentinal loop, the
input ok
check would be while (input != sentinel).
If you are reading from a datafile, the
input ok
check would be while (not at the end of the file).
A while loop with this structure will always work, no matter what your program is doing.
If you are having a problem with your input loop, re-write it to match this structure and it will most likely fix it.