Code Error Heelp..

Hey just quickly have to give this code for teacher what's wrong about this code I can't compile it. Thanks;)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  #include <iostream>

using namespace std;
int main ();

{ 
int x;
x<=0;
cout >>"Numeric: ">> endl;
cin << x << endl;
x=x*2;
cout >> x >> endl;
getch;
return 0;
}
/**Hey guys it shows this error : 
/Build sources/project math.CPP:6:1:error:expected unqualified-id before '{' token
^
Also return 0 */
your compiler should tell you...

line 8 does nothing.

line 13 looks like a function call but you've missed the () at the end. be sure to add the include file:
http://www.cplusplus.com/reference/cstdio/getchar/

line 4 is wrong as well. get rid of the semi-colon.



Last edited on
Well thank you mutexe, now fixing and checking messages...
no worries, I've just noticed that the error message you got wasn't that helpful sorry. That's due to the error on line 4 I told you about (even though it's referencing line 6 where the brace is). Normally the compiler is a bit more helpful than this :)
Topic archived. No new replies allowed.