The do..... while loop in C++

The do.... while loop checks its condition at the bottom of the loop.
A do.... while loop is similar to a while loop. The one difference is that the do.... while loop is guaranteed to execute at least one time.
Syntax:

do
{
statement(s);
}while(condition);

Example:

int a=0;
do
{
cout<<a<<endl;
a++
}while(a<10);

Output:

0
1
2
3
4
5
6
7
8
9

Share Tweet Send
0 Comments
Loading...
You've successfully subscribed to Developer Insider
Great! Next, complete checkout for full access to Developer Insider
Welcome back! You've successfully signed in
Success! Your account is fully activated, you now have access to all content.