0
votes

so I'm having issues with line 8. I am getting an error message saying " argument type int is incompatible with parameter type int". I'm not understanding what the error is saying. What am I doing wrong?

const int NUM_TEST = 5;
int perfectScore(int score[]);
int main()
{
int score ;
double enteredScore[] = {0.00};
int location = 1;
location = perfectScore(score);
cout << "This program will allow you to enter up to 5 scores and will then report how many test scores are entered.\n" << endl;
    int perfectScore(int score[]);
    for (int i = 0; i<=NUM_TEST; i++) {
    cout << "Enter a test score in the range 0 to 100: ";
    cin >> i;
 }

if(score != 100)
{
    cout << "The 5 test scores you entered included " << enteredScore[score] << "perfect scores" << endl;
}
system("pause");
return 0;
}
int perfectScore(int score[])
{ 
int countPerfect = -1;
for(int i = 0; i < NUM_TEST; i++)
{
    if(score[i]==100)
    {
        countPerfect =1;
    }

}
return countPerfect;
}
2
You might want to clarify which language and version you are writing in.Jason Aller
Also it looks like score is int, but the argument for perfectScore is int[] or int*ryanyuyu
I'm using c++; what do you mean by version?sylvanna
When programming, you can't just "guess the source code", you actually have to know what you are doing. There is not much in this program that makes any sense. Also please indent your code when posting it here.Lundin

2 Answers

0
votes

you are giving int to a function that actually accepts int array.

0
votes

Your function is expecting an array of int instead of an int.