C++ do...while loop Statement
loop is similar to a while
loop, except that a do...while
loop executes statement within do block first and then check the condition of while. It guaranteed to execute at least one time of statement.
In do while loop, while statement (loop) ends with a semicolon (;).
Working Process of do...while loop
- The statement inside the do body of the loop is executed.
- Then the condition expression is checked.
- If the condition expression is true, then do body of the loop is executed. This process continues until the condition expression becomes false.
- When the condition expression is false, do...while loop is terminated.
C++ do...while loop Example
This program print counting from 1 to 10.
using namespace std;