Funtion Headers
error C2447: '{' : missing function header (old-style formal list?)
error C2447: '{' : missing function header (old-style formal list?)
I keep getting these two errors when I build my program and can't figure out what is wrong. It all looks correct to me. Any help would be appreciated.
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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
|
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
double medianScore(vector <int>);
char letterGrade(double);
int main ( )
{
int midtermOne;
int midtermTwo;
int final;
double homeworkScore;
char letter;
double totalScore;
vector<int> scores;
cout << "\nPlease enter the score for the first midterm: ";
cin >> midtermOne;
cout << "\nPlease enter the score for the second midterm: ";
cin >> midtermTwo;
cout << "\nPlease enter the score for the final exam: ";
cin >> final;
cout << "\nPlease enter in scores for your homework assignments, ";
cout << "\nend your input with control-z.";
cout << endl;
int aScore;
while(cin >> aScore)
{
scores.push_back( aScore );
}
sort(scores.begin( ), scores.end( ) );
homeworkScore = medianScore(scores);
totalScore = homeworkScore + midtermOne + midtermTwo + final;
letter = letterGrade(totalScore);
cout << "\nThe median homework score was: " << homeworkScore << endl;
cout << "\nThe total points earned was: " << totalScore << endl;
cout << "\nThe calculated letter grade is: " << letter << endl;
system("PAUSE");
return 0;
}
double medianScore(vector<int> scores);
{
const double TWO = 2;
const double ONE = 1;
double median;
const int size = scores.size();
if (size % TWO == 0)
{
median = (scores[size / TWO + ONE] + scores[size / TWO]) / TWO;
}
else
{
median = (scores[(size / TWO) + ONE];
}
return median;
}
char letterGrade(double total);
{
char grade;
if (total >= 300)
{
grade = "Pass";
}
else
{
grade = "Fail";
}
return grade;
}
|
Last edited on
You have semicolons after the function declarations
1 2 3 4
|
double medianScore(vector<int> scores);
{
const double TWO = 2;
....
|
should be without :P
Last edited on
too easy
Topic archived. No new replies allowed.