I was reading through my book on C++ and I reached for loops.
The book told me that on each iteration of the loop, the variable is incremented, then the statement is executed. However, if it's like this, shouldn't it output one extra number because it wouldn't be evaluated until after the iteration. (Like instead of the output ending at 9, it ends at 10) I don't get it, can anyone try to help me make sense of this?
Code:
for (i = 1; i < 10; i++)
{
cout << i << endl ;
}
The book told me that on each iteration of the loop, the variable is incremented, then the statement is executed. However, if it's like this, shouldn't it output one extra number because it wouldn't be evaluated until after the iteration. (Like instead of the output ending at 9, it ends at 10) I don't get it, can anyone try to help me make sense of this?