I\'m not sure where my problem is in this program. I\'m using \'MS Visual C++ 20
ID: 3632988 • Letter: I
Question
I'm not sure where my problem is in this program. I'm using 'MS Visual C++ 2010 Express' to complie it but I keep getting an error.#include <iostream>
#include <iomanip>
using namespace std;
// Function prototypes
void getScore(int &);
void calcAverage(int, int, int, int, int);
int findLowest (int, int, int, int, int);
int main()
{
int test1, test2, test3, test4, test5; // 5 user input test scores
// Call getScore once for each test score to be input
getScore(test1);
getScore(test2);
getScore(test3);
getScore(test4);
getScore(test5);
// Call calcAverage to calculate and display the average
calcAverage(test1, test2, test3, test4, test5);
return 0;
}// end of main function
/*********************************************************************
* getScore *
* This function is called by main once for each test score to be *
* input and validated. The score is stored in a reference parameter.*
*********************************************************************/
void getScore(int &score)
{
cout << "Enter test score: ";//Fill in code
cin >> &score;
}// end of function getScore
/*****************************************************************
* calcAverage *
* This function is called by main to find and print the average *
* of the best 4 out of the 5 scores passed to it as arguments. *
*****************************************************************/
void calcAverage(int s1, int s2, int s3, int s4, int s5)
{
float average;
// funcation call to find lowest score
int low=findLowest(s1,s2,s3,s4,s5);
if(low==s1)
average=static_cast<float>((s2+s3+s4+s5)/4);
else if(low==s2)
average=static_cast<float>((s1+s3+s4+s5)/4);
else if(low==s3)
average=static_cast<float>((s1+s2+s4+s5)/4);
else if(low==s4)
average=static_cast<float>((s1+s2+s3+s5)/4);
else if(low==s5)
average=static_cast<float>((s1+s2+s3+s4)/4);
//outputting average of four test scores
cout << "Average of four test scores: " << average << endl;
}// end of function calcAverage
/**************************************************************
* findLowest *
* This function is called by calcAverage to determine which *
* of the 5 scores passed to it as arguments is the lowest. *
* The lowest score is returned. *
**************************************************************/
int findLowest(int s1, int s2, int s3, int s4, int s5)
{
if (s1 <= s2 && s1 <=s3 && s1 <= s4 && s1 <= s5)
{
return s1;
}
else if (s2 <= s1 && s2 <= s3 && s2 <= s4 && s2 <= s5)
{
return s2;
}
else if (s3 <= s1 && s3 <= s2 && s3 <= s4 && s3 <= s5)
{
return s3;
}
else if (s4 <= s1 && s4 <= s2 && s4 <= s3 && s4 <= s5)
{
return s4;
}
else
return s5;
}
// end of function findLowest