functions-grades and calcs

Ok so I had to make this program that takes an array of test scores and calcs the class avg and then outputs the avg and how many letter grades there were. Now I have to turn it all into functions. I know I'm doing something wrong with the functions but I'm not sure exactly what it is that I'm doing wrong. Here's what I have so far. Thanks for the help.



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
75
76
77
78
79
80
81
82
83
84
85
86
87
#include <iostream>
using namespace std;

void getScores (float testScore[10]);
int getGrades (float testScore[10], float totalScore);
void displayInfo(float avg,int A, int B, int C, int D, int F);

void main (void)
{
	int i = 0;
	float testScore [10];
	getScores (float testScore[10]);
	getGrades (float testScore[10], float totalScore);
	displayInfo(float avg,int A, int B, int C, int D, int F);
	system("pause");
}
	
	
void getScores (float testScore[10])
{
	for (int i=0; i<10; i++)
	{
		cout << "Enter test score " << i + 1 << ": ";
		cin >> testScore[i];
	}//for

	cout << '\n';
}

int getGrades (float testScore[10], float totalScore);
{
	int i(0);
	int A(0);
	int B(0);
	int C(0);
	int D(0);
	int F(0);
	float avg = 0;
	float totalScore = 0;

	for (i=0; i<10; i++)
	{
		if (testScore[i] >= 92.0)
		{
			cout << "Person " << i + 1 << " has a score of: " << testScore[i] << " which is an A" << endl;
			A++;
		}//if
		else if (testScore[i] >= 84.0)
		{
			cout << "Person " << i + 1 << " has a score of: " << testScore[i] << " which is a B" << endl;
			B++;
		}//else if
		else if (testScore[i] >= 75.0)
		{
			cout << "Person " << i + 1 << " has a score of: " << testScore[i] << " which is a C" << endl;
			C++;
		}//else if
		else if (testScore[i] >= 65.0)
		{
			cout << "Person " << i + 1 << " has a score of: " << testScore[i] << " which is a D" << endl;
			D++;
		}//else if
		else //(testScore[i] < 65.0)
		{
			cout << "Person " << i + 1 << " has a score of: " << testScore[i] << " which is a F" << endl;
			F++;
		}//else if

		totalScore += testScore[i];
	}//for

	cout << '\n';

	avg = totalScore/10.0;

	return avg;
}

void displayInfo(float avg,int A, int B, int C, int D, int F)
{
	cout << "The class average is: " << avg << "%" << '\n' << '\n';
	cout << A << " people received the grade A\n";
	cout << B << " people received the grade B\n";
	cout << C << " people received the grade C\n";
	cout << D << " people received the grade D\n";
	cout << F << " people received the grade F\n\n";
}
Looks like a lot of people working on the same homework. Anyway, what is the problem exactly? Does the program compile? Does it not produce the expected output? Tell us the symptoms of the problem so that we don't have to read the whole thing or debug it ourselves. I need to know where to look for potential problems and don't have the time to read and critique the whole thing.
Error 1 error C2144: syntax error : 'float' should be preceded by ')' 25
Error 2 error C2660: 'getScores' : function does not take 0 arguments 25
Error 3 error C2059: syntax error : ')' 25
Error 4 error C2144: syntax error : 'float' should be preceded by ')' 26
Error 5 error C2660: 'getGrades' : function does not take 0 arguments 26
Error 6 error C2059: syntax error : ')' 26
Error 7 error C2144: syntax error : 'float' should be preceded by ')' 27
Error 8 error C2660: 'displayInfo' : function does not take 0 arguments 27
Error 9 error C2059: syntax error : ')' 27
Error 10 error C2447: '{' : missing function header (old-style formal list?) 44


I dont understand what I need to do to fix any of these errors
Use int main().

To fix your errors, you need to call the functions correctly:
http://www.cplusplus.com/doc/tutorial/functions/
Topic archived. No new replies allowed.