The C++ While Loop
A while loop says to perform a set of operations while a condition is true. It is known as a pre-test loop, because the condition is tested before the loop is run at all, meaning the body of the loop may never run. The general form for a while loop is: Notice that the loop…