我试图在如何编程中编写练习2.19的程序,但我遇到了一些困难.
该方案应该让用户输入三个整数,然后显示sum,average和product那些整数.
我唯一的问题是显示最大和最小.当我运行程序并输入三个整数时(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)