简单流程图

发布于 2024-11-19 00:52:00 字数 625 浏览 1 评论 0 原文

void main()
{
    int numTickets;
    float discount;
    float total = 0.0;
    int numKids = 0;
    float ticketPrice = 19.00;
    printf("Enter number of tickets: ");
    scanf("%d", &numTickets);
 if (numTickets > 10)
 {
   discount = 0.15;
 }
 else
 {
   discount = 0.0;
 }
   printf("Enter number of children: ");
   scanf("%d", &numKids);
   total = numKids*ticketPrice/2.0 + (numTickets – numKids)*ticketPrice;
   total = total*(1.0 – discount);
   printf("Total = %.2f \n", total);
}

基本上,我正在帮助我表弟学习,其中一个问题是为此绘制流程图。问题是我忘记了我所知道的关于流程图的一切!顶部的可变减速度有标准吗?其实我可以弥补剩下的部分,只是不知道如何开始了!

void main()
{
    int numTickets;
    float discount;
    float total = 0.0;
    int numKids = 0;
    float ticketPrice = 19.00;
    printf("Enter number of tickets: ");
    scanf("%d", &numTickets);
 if (numTickets > 10)
 {
   discount = 0.15;
 }
 else
 {
   discount = 0.0;
 }
   printf("Enter number of children: ");
   scanf("%d", &numKids);
   total = numKids*ticketPrice/2.0 + (numTickets – numKids)*ticketPrice;
   total = total*(1.0 – discount);
   printf("Total = %.2f \n", total);
}

basically, im helping my cousin study and one of the questions is to draw a flowchart for that. the problem is iv forgotten everything i ever knew about flowcharts! Is there a standard for the variable declerations at the top? I can make up the rest of it actually, just not sure how to start em anymore!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

陌伤ぢ 2024-11-26 00:52:00

常规分配(如变量初始化)应出现在普通矩形中(如 http://upload.wikimedia.org/wikipedia/commons/d/d6/FlowchartExample.png)。

请记住,IO(如 printf/scanf 语句)应采用平行四边形,条件分支应采用菱形。

Regular assignments (like your variable initialisations) should appear in a normal rectangle (like those in http://upload.wikimedia.org/wikipedia/commons/d/d6/FlowchartExample.png).

Remember that IO (like your printf/scanf statements) should be in parallelograms, and conditional branches in diamonds.

抹茶夏天i‖ 2024-11-26 00:52:00

非常基本的规则:

  • 变量声明(以及一般的代码块)进入矩形框
  • 条件(也是迭代)进入菱形
  • 输出进入平行四边形

维基百科文章可能很有用。

The very basic rules:

  • variable declarations (and in general blocks of code) go into rectangular boxes
  • conditions (also of iterations) go into diamonds
  • outputs go into parallelograms

Wikipedia article can be useful.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文