简体   繁体   中英

ERROR: argument type int incompatible for parameter type

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;
}

您将int赋予实际上接受int数组的函数。

您的函数需要一个int数组,而不是一个int数组。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM