Why am I getting this error?
Hi,
So I just started learning C++ (I'm Microsoft Visual C++), and I was working on a program that shows the relationship between two numbers.
This is what I did:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
#include <iostream>
using namespace std;
int main();
{
int num1, num2;
cout << "Enter two integers to see the relationship between them!";
cin >> num1 >> num2
if (num1 == num2)
cout << num1 << "is equal to" << num2 << endl;
if (num1 > num2)
cout << num1 << "is greater than" << num1 << endl;
if (num1 < num2)
cout << num1 << "is less than" << num2 << endl;
if (num1 != num2)
cout << num1 << "is not equal to" << num2 << endl;
if (num1 >= num2)
cout << num1 << "is greater than or equal to" << num2 << endl;
if (num1 <= num2)
cout << num1 << "is less than or equal to" << num2 << endl;
cout << "Thank you and have a great day!" << endl;
system("pause");
return 0;
}
|
When I try and debug it, I get this error:
error C2447: '{' : missing function header (old-style formal list?)
What am I doing wrong?
Thank you so much for any help!
You need to get rid of the terminator (the ; character) after the main()
.
Thanks! I guess I didn't check everything over well enough myself.
Topic archived. No new replies allowed.