c++ - double 类型的参数与参数类型双指针不兼容

标签 c++ types double

试图找到最低分和最高分,但我一直出错

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

最佳答案

正如@jogojapan 指出的那样,您将不得不更改这些

  cout << "The lowest of the results = " << find_lowest(score[5]);
  cout << "The highest of the results = " << find_highest(score[5]);

  cout << "The lowest of the results = " << find_lowest(score);
  cout << "The highest of the results = " << find_highest(score);

您的函数需要 double 组,而不是 double 元素。

关于c++ - double 类型的参数与参数类型双指针不兼容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19887026/

相关文章:

c++ - C++中<<运算符重载函数的返回类型

Android NDK 找到动态链接 : unable to debug library

c++ - 字符串查找方法找不到第一个字母

c++ - 从输入文件到输出文件的算术运算?

java - 双括号初始化类型混淆

generics - 通用特征对象的向量

iphone - 我不应该在 iPhone 代码中使用哪些变量类型?

java - 如何处理这个格式化的数字 "XYe+02"

java - Java 中复杂对象的不精确比较?

java - 从具有颜色强度的双数组创建图像