简体   繁体   English

错误:参数类型int与参数类型不兼容

[英]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". 所以我在第8行遇到了问题。我收到一条错误消息,提示“参数类型int与参数类型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数组。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 “类型为 &#39;int(*)()&#39; 的参数与类型为 int 的参数不兼容”错误? - "argument of type ”int(*)()“ is incompatible with parameter of type int" error? “int*”类型的参数与“int**”类型的参数不兼容 C++ 中的错误 - argument of type “int*” is incompatible with parameter of type “int**” error in C++ “int”类型的参数与“int*”类型的参数不兼容 - argument of type “int” incompatible with parameter of type “int*” 类型为“ int”的参数与类型为“ int *”的参数不兼容 - Argument of type “int” is incompatible with parameter of type “int *” 类型“ int”的参数与参数类型“ int **”不兼容 - argument of type “int” is incompatible with parameter type “int **” 类型“int”的参数与类型“int”的参数不兼容 - argument of type “int” incompatible with parameter of type “int” int(*)[] 类型的参数与“int**”类型的参数不兼容 - Argument of type int(*)[] is incompatible with parameter of type “int**” “ int”类型的参数与“ char”类型的参数不兼容 - Argument of type 'int' is incompatible with parameter of type 'char' “int”类型的参数与“HTREEITEM”类型的参数不兼容 - argument of type “int” is incompatible with parameter of type “HTREEITEM” 类型参数与类型错误参数不兼容 - argument of type is incompatible with parameter of type error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM