Introduction to C++
while loop, which may never execute, a do...while loop is guaranteed to execute at least once.
Structure of do…while loop:
The line containing the while part ends with a semicolon (
Now let's compare the while and do…while loops.
The while loop:
The do...while loop:
The do...while loop executed 1 time when the while loop would never have executed.