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 this

Join

Search articles

Search titles, tags and article content.

    You've successfully subscribed to Developer Insider
    Your account is ready. Welcome to Developer Insider
    Welcome back! You've successfully signed in
    Success! Your account is fully activated, you now have access to all content.