This may already be a question out there, but with the lack of specific key terms, it's a bit hard to search for. Just looking for more insight on this topic.
Right now, I'm working in C++ and wondering why my value is replaced with an incremented value when I compare using "++".
So here, we print 14 times (numbers 1-14).
int i = 0, x = 0;
while (x < 30) {
x++;
if (13 < i++) break;
cout << i << endl;
}
Here, we print 30 zeros.
int i = 0, x = 0;
while (x < 30) {
x++;
if (13 < i+1) break;
cout << i << endl;
}
And this just plain doesn't work. (I wanted to try because i++
= i=i+1
).
int i = 0, x = 0;
while (x < 30) {
x++;
if (13 < i=i+1) break;
cout << i << endl;
}