0
The for loop has three different parts at the beginning. The first part is a variable definition. The second part is the condition to be met for the loop to run. The third part is code that is executed at the end of each loop. for(int count = 0; count < 10; ++count) std::cout << count << '\n'; An int is declared and assigned the value of 0 and the loop will run if it is less than 10. The code in the next line will just print the value of count. After that, count is incremented and then the condition is checked again before the loop continues. After the loop is run 10 times, count is no longer aless than 10 and the loop ends.
3rd Feb 2017, 8:11 AM
R- Ry
R- Ry - avatar