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

时间:2014-12-09 19:03:41

标签: c++ arrays function for-loop int

所以我遇到第8行的问题。我收到一条错误消息,说“参数类型int与参数类型int不兼容”。我不明白错误在说什么。我究竟做错了什么?

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 个答案:

答案 0 :(得分:0)

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

答案 1 :(得分:0)

你的函数期望一个int数组而不是int数组。