Apr 9, 2014 at 5:54pm UTC
hello everyone, I am getting error codes "No matching function for call to 'getScore'" when I call getScore function in my main function. Can someone please tell me what I am doing wrong. This assignment has to do with passing reference variables.
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
#include <iostream>
#include <iomanip>
using namespace std;
void getScore(double &, double &, double &, double &, double &);
int main()
{
double score1, score2, score3, score4, score5;
getScore(score1);
getScore(score2);
getScore(score3);
getScore(score4);
getScore(score5);
return 0;
}
//*********************
// getScore function
//*********************
void getScore(double &sc1, double &sc2, double &sc3, double &sc4, double &sc5)
{
// variables
double score;
// prompt user for score
cout << " Please enter test score : " ;
cin >> score;
// validate score
while ( score < 0 || score > 100)
{
cout << " Please enter a score between 0 and 100 " ;
cin >> score;
}
}
Last edited on Apr 9, 2014 at 5:59pm UTC
Apr 9, 2014 at 6:04pm UTC
its because you are only passing one variable to it. why are you saying it takes arguments at all when you dont even use them?
Apr 9, 2014 at 6:11pm UTC
whoops I didn't realize that sorry. Thanks for the help!