The C++ Do-While Loop

The Do-While loop is similar to the while loop. It is a conditional loop, just like the while loop, running the body of the loop while the condition is met. However, the big difference is that the do-while loop is a post-test loop. That means that the body runs at least once, and then there…

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…