Calculating avg scores

I am creating a program that will ask the user to enter 5 scores, then it will take these 5 scores and drop the highest and lowest scores. It will then average the 3 remaining scores. I am doing this without the use of arrays.

I have many errors. What I am not understanding is what the correct parameters are for each function, can anyone help me on this?

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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74

# include <iostream>
# include <iomanip>
using namespace std; 

void getJudgeData (double&score) {

	cout<<"Enter the judge's score:";
	cin>> score;

	while (score < 0 || score > 10) {
		cout<< "Invalid Score."<<endl; 
		cout<< "Enter judge's score:"; 
		cin >> score; 
	}
} 

void calcScore (double a,b,c,d,e) { 
	double sum;
	double avg;
	double highest,lowest;

	sum = a+b+c+d+e;
	sum = sum - findHighest(double highest)-findLowest(double lowest);
	avg = sum/3; 
}

int findLowest (lowest) {
	double lowest = 10;
	if (a < lowest)
		lowest = a;
	if (b < lowest)
		lowest = b;
	if (c < lowest)
		lowest = c;
	if (d < lowest)
		lowest = d;
	if (e < lowest)
		lowest = e;

	return lowest;
}

int findHighest (highest){
	double highest = 0;
	if (a > highest)
		highest = a;
	if (b > highest)
		highest = b;
	if (c > highest)
		highest = c;
	if (d > highest)
		highest = d;
	if (e > highest)
		highest = e;

	return highest; 
}

int main () {

	double score1,score2,score3,score4,score5;
	double avg; 

	getJudgeData(score1);
	getJudgeData(score2);
	getJudgeData(score3);
	getJudgeData(score4);
	getJudgeData(score5);
	calcScore(double a,b,c,d,e); 

	return 0;
}
Errors are?
many undeclared identifiers, as well as "function-style initializer appears to be a function definition"
List please. Need at least the line numbers, and the whole things never hurt. They're easier to read than people think.

1>------ Rebuild All started: Project: Assignment 10, Configuration: Debug Win32 ------
1>Deleting intermediate and output files for project 'Assignment 10', configuration 'Debug|Win32'
1>Compiling...
1>Assignment 10.cpp
(21) : error C2061: syntax error : identifier 'b'
(26) : error C2065: 'b' : undeclared identifier
(26) : error C2065: 'c' : undeclared identifier
(26) : error C2065: 'd' : undeclared identifier
(26) : error C2065: 'e' : undeclared identifier
(27) : error C2144: syntax error : 'double' should be preceded by ')'
(27) : error C2059: syntax error : ')'
(27) : error C3861: 'findHighest': identifier not found
(31) : error C2065: 'lowest' : undeclared identifier
(31) : error C2448: 'findLowest' : function-style initializer appears to be a function definition
(47) : error C2065: 'highest' : undeclared identifier
(47) : error C2448: 'findHighest' : function-style initializer appears to be a function definition
(73) : error C2144: syntax error : 'double' should be preceded by ')'
(73) : error C2660: 'calcScore' : function does not take 0 arguments
(73) : error C2059: syntax error : ')'

- 15 error(s), 0 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
The abcde undeclared ones are all for your findLowest function. Take a look at it - where are those variables declared? (And PLEASE don't ask me, "well how do I fix it?" It's your program, not mine. I'd just pass in the variables but five at a time is really quite inefficient. Array, maybe?)
The next error is because you take an argument lowest in find lowest. But you don't identify its type. In addition, you are redeclaring the variable which will obscure the other one if not create a syntax error.
You also probably should not declare variables in the same line in which you call a function on them. Declare them outside the line instead of doing stupid "shortenings" under the illusion that they will save time and space.
You call findlowest and findhighest in calcscore. But the program doesn't see the declarations until later in the program. You can prototype them or you can just move the declarations up the list of functions. (Prototyping in the functions tutorial of this site.)
The last issue is, ONCE AGAIN, declaring things in the line in which you call a function on them. Please stop doing that. It's stupid, silly and, as stylishly evidenced by your fifteen errors, does not work.
Fix those and see what happens.
thanks...
Topic archived. No new replies allowed.