I've been trying to understand what's wrong here, I've ever looked up examples of while loops, the samples people give online still produce errors in my IDE. Any ideas?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include <iostream>
usingnamespace std;
int main () {
int a;
while( a < 20 ) {
cout << "value of a: " << a << endl;
a++;
}
return 0;
}
These are my errors..
expected ')' before ';' token line 5 C/C++ Problem
expected primary-expression before ')' token line 5 C/C++ Problem
expected primary-expression before '<' token line 5 C/C++ Problem
I'm so confused as to how C++ works... I copied and pasted your code & it worked. I re-copied my code and pasted it and it started working. This is frustrating and really hurting my motivation to learn if I'm going to get false errors. grrrrrr
Could be an encoding error with your IDE and original source. You might have typed something not plain text or saved the file as something other than plain text.