It seems very simple, but I cant fix it!

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

int main ();

{

int a;

cout << "What is your age?" << endl;
cin >> a;

if (a < 11)
cout << "You are " << 11 - a << " years younger than me." << endl;

else if (a > 11)
cout << "You are " << a - 11 << "years older than me." << endl;

else
cout << "You are my age." << endl;

return 0;

}


This is a very simple program. My compiler says that there is something wrong with the first "{". I can't fix it though. Here is the error:
Error E2040 age.cpp 5: Declaration terminated incorrectly


If you could help that would be great. Thank you.
There is an extra semicolon on line 3. Also, cout and endl will not be known identifiers without their namespace qualifications. Insert using namespace std; before main.
Thanks! It worked.
Topic archived. No new replies allowed.