在我正在做的问题中,我需要有关流程图的帮助。我已经完成了编程代码,但对流程图一无所知,如果有人能给我一个关于如何做到这一点的想法,那么我将不胜感激。这是问题:
编写一个 C++ 程序,从键盘读取 3 个整数,并带有正确的输入提示,然后显示这三个数字中任意一对数字的最大和。例如,如果这 3 个数字是 5、6 和 7,那么最大和来自 6+7=13。画出这个 C++ 程序的流程图,并在桌面检查程序中是否有三个输入整数 12、3 和 7,或一组不同的 3 个数字,这将使桌面检查在您的程序设计中变得不那么琐碎。
我已经完成了以下代码:
代码:
#include <iostream>
using namespace std;
int main()
{
int num1, num2, num3, sum;
cout << "Enter number ";
cin >> num1;
cout << "Enter number ";
cin >> num2;
cout << "Enter number ";
cin >> num3;
/* if(num1 >= num2)
{
}*/
if(num1 > num2 && num3 >
num2)
{
sum = num1 + num3;
cout << "The sum of " << num1 << " and " << num3 << " = " << sum << endl;
}
else if(num1 >= num3 && num2 >= num3)
{
sum = num1 + num2;
cout << "The sum of " << num1 << " and " << num2 << " = " << sum << endl;
}
else if (num2 >= num1 && num3 >= num1)
{
sum = num2 + num3;
cout << "The sum of " << num2 << " and " << num3 << " = " << sum << endl;
}
//else
//{
// cout << "all three numbers must be diffrent" <<endl;
// }
system("PAUSE");
return 0;
}