简体   繁体   English

需要帮助的流程图

[英]Need help with a flowchart

I need help with a flowchart in a question I'm doing. 我在做一个问题时需要流程图的帮助。 I've completed the programming code but just have no idea on flowcharts if anyone can give me an idea on how to do this then I'll appreciate it. 我已经完成了编程代码,但是对流程图一无所知,如果有人可以给我一个方法的想法,那么我将不胜感激。 This is the question: 这是问题:

Write a C++ program that reads from keyboard 3 integers, with proper input prompt, and then displays the maximum sum of any pair of numbers from these three. 编写一个C ++程序,该程序从键盘上读取3个整数,并带有正确的输入提示,然后显示这3个整数对的最大和。 If the 3 numbers are 5, 6 and 7 for instance, then the maximum sum comes from 6+7=13. 例如,如果3个数字分别是5、6和7,则最大和为6 + 7 = 13。 Draw the flowchart of this C++ program, and also desk check the program for the three input integers 12, 3 and 7, or a different set of 3 numbers which will make the desk checking less trivial within your program design. 绘制此C ++程序的流程图,并对三个输入整数12、3和7或一组不同的3个数字进行桌面检查,这将使桌面检查在程序设计中变得不那么琐碎。

I've completed the code which is: 我已经完成了以下代码:

Code: 码:

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

You should read about Flowcharts . 您应该阅读流程图 If you do not know about Flowcharting how will you make one. 如果您不了解流程图,将如何制作流程图。

阅读有关流程图的信息,请参阅http://www.edrawsoft.com/flowchart-examples.php上的流程图,并进行概念化。

Read up on state machines . 状态机上阅读。 This will help you map out the behavior of your program and to create the necessary flow charts. 这将帮助您确定程序的行为并创建必要的流程图。 :) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM