【发布时间】:2013-11-22 02:44:00
【问题描述】:
试图找到最低分和最高分,但我不断收到错误
argument of type "double" is incompatible with parameter of type "double*"
代码:
cout << "The lowest of the results = " << find_lowest(score[5]);
cout << "The highest of the results = " << find_highest(score[5]);
system("Pause");
}
double find_highest(double a[])
{
double temp = 0;
for(int i=0;i<5;i++)
{
if(a[i]>temp)
temp=a[i];
}
return temp;
}
double find_lowest(double a[])
{
double temp = 100;
for(int i=0;i<5;i++)
{
if(a[i]<temp)
temp=a[i];
}
return temp;
}
【问题讨论】:
-
您的函数需要一个
double数组,但您只传递了一个double元素。score[5]表示“名为score的数组的第 5 个元素”。 -
“感谢支持”作为提问主题绝对没有意义,对于本站以后的用户在搜索时使用毫无价值。请edit 提供有用且与您的问题内容相关的内容。