小编Jen*_* R.的帖子

Max 和 Min 显示为 true 而不是数字,我该怎么办?

我需要数组中的最小和最大数字,但它告诉我函数的地址将始终为 true 而不是数字。我想不出要改变什么。

#include <iostream>

using namespace std;

int main()
{
    double num1[10] {0.61, 1.70, 0.52, 1.34, 0.25, 1.20, 0.46, 1.10, 1.68, 1.37}; //material used in february
    double total1 {0};
    float average1 {0};
    int i;

    for (i=0; i<10; i++)
    {
        total1 = total1 + num1[i];
    }

    average1 = total1/10.0; //average of material used in feb

    double max1(double num1); // maximum of material used in feb

    double min1(double num1); // minimum of material used in feb

    cout << "Maximum is " …
Run Code Online (Sandbox Code Playgroud)

c++ arrays max min

2
推荐指数
1
解决办法
95
查看次数

标签 统计

arrays ×1

c++ ×1

max ×1

min ×1