So I just started c++ about an hour ago. I'm currently following a guide to help me learn, but I can't get past this error error: expected unqualified-id before '{' token. I've tried google and other forums, but nothing.
Here's my code, I hope yall can help!
1 2 3 4 5 6 7 8 9 10 11
#include <iostream>
usingnamespace std;
int main();
{
variable x = 5;
variable y = 7;
cout "\n"
cout << x + y << " " << x * y
cout "\n";
return 0;
}
There is no such thing as "variable", you have to choose a type to represent the variable. (char, short, int, long, float, double, sound familiar?)
You're missing a semicolon on line 7.
You're missing a semicolon on line 8.
You should use endl instead of "\n" for putting a new line out, if you don't there are cases where you may not see your output even if the console stays open for an extended period of time.
You still didn't add a semicolon to the end of line 7. Also, it needs to be cout << endl;
Also, you really should remove that semicolon after int main() as it is the reason you're getting that error.