CodePudding user response:
Difference between how this can explain, don't like the book says the?
Usage scenario, while for an infinite loop
Whlie (true)
{
//infinite loop
}
Suitable for words count
//do a repeat of 100
for (int i=0; I & lt; 100; I++)
{
}
Other do not have what distinction, various circulation can achieve the same goal, it's just whether convenient, you can need not consider the performance gap between them
CodePudding user response:
The do... Run at least once a while for the ~CodePudding user response:
For can manage all requirementsCodePudding user response:
Seldom used the do... WileFor fine
CodePudding user response:
Generally speaking, the loop body same wordsWhile efficiency is higher than the for, but the speed is more do not have what meaning, the key or the loop body
For more flexible, the do... While the flow chart is more easy to understand
CodePudding user response:
Essentially no difference, different wording,