+ 2
What is the different between while and do .... while in pension?
2 Respostas
+ 16
As an example for Daniel's nice explanation, compare these two blocks,
....
bool b1 = false;
while (b1) { // condition at first
cout << "Program flow skips this cout! ";
}
do {
cout << "This cout is going to execute at least once! ";
} while (b1); // condition at last
+ 4
while first check condition and next run instructions
do while first run instructions and next check condition