Hello.
I just started learning C++ today from your wonderful tutorials on the website, thank you very much for those by the way. I would like to get this sorted because I'm finding it fun to learn here and it's easier that way. I've had some bad experiences with a book previously and I don't want to go through that again until I learned at least the basics. I hope this is the right section of the forum to post my question.
Thing is, I ran into a tiny problem at the Loops Quiz, the very first question.
1. What is the final value of x when the following code is run?
A. 10
B. 9
C. 0
D. 1
I answered 9, but the correct one is 10.Code:int x; for (x=0; x<10; x++) {}
Did I misunderstand the question? The final value for which the loop will occur is clearly 9, I also added a cout << x to the code above just to be sure and it showed me the same thing. For x=10, the loop will not happen because the condition is checked at the beginning, so why is the final value 10?
I'm sorry I realize this is a very beginner question but I don't want to mess anything up now and find out that it adds up later on to a larger list of misunderstandings that I'll have to sort out then.
Take your time with the reply and thank you.