what is meant that "do...while" loop is guaranteed to execute at least one time, in C++? Please someone should help me. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

what is meant that "do...while" loop is guaranteed to execute at least one time, in C++? Please someone should help me.

23rd Jun 2016, 11:36 AM
IBRAHIM ABDULAI YAKUBU
4 Answers
+ 3
It will execute the statements written in the do { } clause no matter the condition is true or false. Then it will check the condition in the while( ) and repeat the loop if it is true. For example: int x = 3; do { // some statements } while(x > 5); This will execute the statements once, even considering that x is not greater than 5.
23rd Jun 2016, 12:31 PM
James Flanders
0
It means the code inside the while loop will always execute once before the condition to keep looping is checked.
23rd Jun 2016, 6:39 PM
Andy Amaya
Andy Amaya - avatar
0
it's do and while so it first does execute(do) and then the condition is used so it is guaranteed that it is executed whatever the case is
28th Jun 2016, 9:17 AM
MKS monkey
MKS monkey - avatar
0
Write a C++ program to check whether an integer is positive or negative
26th Nov 2020, 1:37 PM
Jommel D. Gabane
Jommel D. Gabane - avatar