missing function header (old-style formal list?) build error

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
#include <iostream>
using namespace std;

int main();
{
	int score;
	
	Cout << "enter score below to see your result:\n";
	cin >> score;

	if (score < 0) {
		cout << "not a legal score!\n\n";
	}else if (score >= 0 && score < 100) {
		cout << "not much to brag about.\n\n";
	}else if (score >= 100 && score < 500) {
		cout << "good job!\n\n";
	}else if (score >= 500 && score < 1000) {
		cout << "Really good score!\n\n";
	}else (score >= 1000) {
		cout << "Awesome score!\n\n";
	}

    system("pause");
    return 0;

}


Can someone tell me whats going wrong here?
Sometimes it's the little things...
int main(); //what's wrong here ?

yea i just saw that but i still get build errors
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
#include <iostream>
using namespace std;


int main()
{
	int score;
	
	cout << "enter score below to see your result:\n";
	cin >> score;

	if (score < 0) {
		cout << "not a legal score!\n\n";
	}else if (score >= 0 && score < 100) {
		cout << "not much to brag about.\n\n";
	}else if (score >= 100 && score < 500) {
		cout << "good job!\n\n";
	}else if (score >= 500 && score < 1000) {
		cout << "Really good score!\n\n";
	}else (score >= 1000) {
		cout << "Awesome score!\n\n";
	}

    system("pause");
    return 0;

}
Last edited on
it says now missing ';' before '{' ?
I'm not sure why, but if i add an 'if' at the last 'else' then it works. so try writing:

else if (score >= 1000) {
cout << "Awesome score!\n\n";
}

it should work.
thanks it works now
1
2
3
else (score >= 1000) {
		cout << "Awesome score!\n\n";
	}


this is like writing

1
2
3
else (score >= 1000)

    cout << "Awesome score!\n\n";


the compiler complains you didn't put a semi colon at the end of the ')' parenthesis, the problem is you can't say else (condition), you either say else or you say else if (condition)

Topic archived. No new replies allowed.