The
do...while loop is a post-test loop. It is very similar to the while loop, but it is used less often.The general form of the
do...while loop:do <statement> while (<boolean statement>)
Execution of the while statement:
Example:
int a = 8;
do
{
cout << a << endl;
a++;
}while (a < 5);
Output:
8
Previous slide