Monday, October 3, 2016

Muhammad Akbar

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);
OR

do
{
 statement
}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
do
{
 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

Muhammad Akbar

About Muhammad Akbar -

Author Description here.. Nulla sagittis convallis. Curabitur consequat. Quisque metus enim, venenatis fermentum, mollis in, porta et, nibh. Duis vulputate elit in elit. Mauris dictum libero id justo.

Subscribe to this Blog via Email :

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