Error No matching function to call

I've been working on my first experiences with functions and from my textbook I believe that this void function should properly compile and I keep getting the error message, "error no matching function for call to" Is there something small that I'm missing? Thanks a lot.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include<iostream>

using namespace std;

void getJudgeData(double &, double &, double &, double &, double &);

int main()
{
    getJudgeData();
}

void getJudgeData(double &score1, double &score2, double &score3, double &score4, double &score5)
{
    cout << "Enter all 5 judge's scores." << endl;
    cout << "Hit enter after each score:" << endl;
    cin >> score1 >> score2 >> score3 >> score4 >> score5;
}
You have defined the function to take five references to doubles, however you are calling it without any parameters.

Try this instead:
1
2
3
4
5
6
7
8
9
10
//...

int main() {
    double score1, score2, score3, score4, score5;
    getJudgeData(score1, score2, score3, score4, score5);

    // ...
}

// ... 

Also, this is a case where using an array might be better.
Thanks a lot! I'm very new to C++ still. Just taking my first class on it now. How would I use an array?
With an array, you can basically store related information in one variable. In this case:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>

void getJudgeData(double* scores);

int main() {
    double scores[5];
    getJudgeData(scores);

    // ...
}

void getJudgeData(double* scores) {
    std::cout << "Enter all 5 judge's scores: ";
    std::cin >> scores[0] >> scores[1] >> scores[2] >> scores[3] >> scores[4];
}

Try looking at a tutorial on arrays or the like.
Thank you so much! We have just begun to learn about arrays I will try that out. Is there a way I can give you a good rating or anything since you have been so helpful? I am new to cplusplus.com as well.
Symphoneee wrote:
Is there a way I can give you a good rating or anything since you have been so helpful?

Don't think so. It doesn't matter anyway; saying 'thanks' is perfectly adequate!
Topic archived. No new replies allowed.