Our social:

Monday, October 3, 2016

Do While Loop in C++

In some situations we need to execute the body (statements) of the loop before testing the expression (condition). In those cases we need do-while loop.
Do-while loop can be presented in the following way

do statement while (expression);

}while (expression);
It's similar to the while loop. The main difference is that the expression is checked after the statement is executed:

//condition is false but we can enter the do block
 cout << "I am inside even the expression is false" << endl;
}while (false);
The output of above code will be
I am inside even the expression is false
The sequence of actions in do .. while loop is as follows:
Step1: Perform block of instructions.
Step2: Check condition. If condition is true go to 1. Else Stop.
do while loop


   C++ For Loop


Post a Comment

Hello Every One thanks For Visit My site You Can Suggest any Idea About site And Related Education Information Provide me Its Best Content For you am Include in this Site And feel free contact And email now I hope This site very help full you