Take a look at this code:
int number = 9;
if ( number++ == 10)
cout << ”True” ;
cout << ”False";
Nevermind the bad formatting, does this code result in "true" or "false"?
To me, it is obvious that 'number++==10' is true if 'number' initially has the value '9'. The thing is, I just did a test for an internet C++ course that I am attending, which gave us this code. When I chose that the result would be "true", I got a message stating that "false" was the right answer.
Have I missed something, or is it the test that was faulty?
The only thing I can think of is the position of '++', and that 'number++' makes the addition to number after the sentence in which it is written. But I do not know if that is the case.