I am writing the following program that calculates the average of a group of test scores where the lowest score in the group is dropped. It has the following functions:
void getScore()-should ask the user for a test score, store it in a reference parameter variable, and validate it. This function should be called by main once for each of the five scores to be entered.
void calcAverage() should calculate and display the average of the four highest scores. This function should be called just once by main and should be passed the five scores.
int findLowest(): should find and return the lowest of the five scores passed to it. It should be called by the calcAverage, who uses the function to determine which of the five scores to drop.
So far, here is my version of the program:
#include <iostream>
#include <iomanip>
using namespace std;
void getscore(int, int, int, int, int);
int findLowest (int, int, int, int, int);
void calcAverage (int, int, int, int, int, int);
int main()
{
int average, score1, score2, score3, score4, score5;
getscore (score1, score2, score3, score4, score5);
calcAverage (average, score1, score2, score3, score4, score5);
return 0;
}
void getscore (int score1, int score2, int score3, int score4, int score5)
{
cout << "Enter first score: ";
cin >> score1;
cout << "Enter second score: ";
cin >> score2;
cout << "Enter third score: ";
cin >> score3;
cout << "Enter fourth score: ";
cin >> score4;
cout << "Enter fifth score: ";
cin >> score5;
}
void calcAverage (int average, int score1, int score2, int score3, int score4, int score5)
{
int small=findLowest(score1,score2,score3,sc…
average = ((score1 + score2 + score3 + score4 + score5)-small)/4;
cout << average;
}
int findLowest(int score1, int score2, int score3, int score4, int score5)
{
int small =score1;
if(small>score2)
{
small=score2;
}
if(small>score3)
{
small=score3;
}
if(small>score4)
{
small=score4;
}
if(small>score5)
{
small=score5;
}
return small;
}
I am getting errors such as:
----unresolved external symbol "void __cdecl calcAverage(int,int,int,int,int)" (?calcAverage@@YAXHHHHH@Z) referenced in function _main
----error LNK2019: unresolved external symbol "void __cdecl getscore(int &,int &,int &,int &,int &)" (?getscore@@YAXAAH0000@Z) referenced in function _main
PLEASE HELP!!!