小编use*_*432的帖子

显示最大和最小数字时出错

我试图在如何编程中编写练习2.19的程序,但我遇到了一些困难.

该方案应该让用户输入三个整数,然后显示sum,averageproduct那些整数.

我唯一的问题是显示最大和最小.当我运行程序并输入三个整数时(8, 9, and 10),输出读取Smallest is 8 AND Smallest is 9.

我希望你能告诉我为什么.

#include <iostream>
using namespace std;

int main ()
{   int x, y, z, sum, ave, prod;

    cout << "Input three different integers ";
    cin >> x >> y >> z;

    sum = x + y + z;
    cout << "\nThe sum is " << sum;

    ave = (x + y + z) / 3;
    cout << "\nThe …
Run Code Online (Sandbox Code Playgroud)

c++ math pearson

0
推荐指数
1
解决办法
496
查看次数

标签 统计

c++ ×1

math ×1

pearson ×1