zoukankan      html  css  js  c++  java
  • 20150324 练习1 四则运算题目的程序 升级版

    #include<stdio.h>
    #include<stdlib.h>
    main()
    {int a,b,op,os;
     printf(" [每课一练 妈妈再也不用担心我的学习]\n");
    aq1: printf("选择您想挑战的运算法则\n");/*新版本跟新如下*/
     printf("0.退出 1.加法 2.减法 3.乘法 4.除法 5.做分数题\n");/*添加退出功能*//*增加分数计算*//*增加随机数范围0~100*/
     scanf("%d",&op);
     if(op==0)
         exit;
     switch(op)
     {
    aq: case 1:
     a=rand()%100;b=rand()%100;
     printf("题目为:%d + %d = ?\n\n",a,b);
     printf("1.查看答案 2.做下一题\n");
     scanf("%d",&os);
     if(os==1)
     {printf("%d + %d =%d\n\n\n",a,b,a+b);
     goto aq1;
     }
     else
     goto aq;
     break;
    at: case 2:a=rand()%100;b=rand()%100;
     printf("题目为:%d - %d = ?\n\n",a,b);
     printf("1.查看答案 2.做下一题\n");
     scanf("%d",&os);
     if(os==1)
     {printf("%d - %d =%d\n\n\n",a,b,a-b);
     goto aq1;
     }
     else
     goto at;
     break;
    aq2: case 3:
     a=rand()%100;b=rand()%100;
     printf("题目为:%d * %d = ?\n\n",a,b);
     printf("1.查看答案 2.做下一题\n");
     scanf("%d",&os);
     if(os==1)
     {printf("%d * %d =%d\n\n\n",a,b,a*b);
     goto aq1;
     }
     else
     goto aq2;
     break;
    aq3: case 4:
     a=rand()%100;b=rand()%100;
     printf("题目为:%d / %d = ?\n\n",a,b);
     printf("1.查看答案 2.做下一题\n");
     scanf("%d",&os);
     if(os==1)
     {printf("%d / %d =%d\n\n\n",a,b,a/b);
     goto aq1;
     }
     else
     goto aq3;
     break;
     aq5: case 5:
     a=rand()%100;b=rand()%100;
     printf("题目为:%d / %d = ?\n\n",a,b);
     printf("1.查看答案 2.做下一题\n");
     scanf("%d",&os);
     if(os==1)
     {printf("%d / %d =%d\n\n\n",a,b,a/b);
     goto aq1;
     }
     else
     goto aq5;
     }
    }
     

  • 相关阅读:
    Android Studio 之 no render target selected
    将android模拟器上的db文件拷贝到电脑上
    两种思路从0打印到100
    RN picker使用
    android打印日志封装
    android仿支付宝输入车牌号
    OC仿支付宝输入UITextField输入车牌号
    RN全局的变量,方法,全局类,全局类方法
    RN九宫格
    RN正、反向传值,组件输出
  • 原文地址:https://www.cnblogs.com/kasion/p/4384165.html
Copyright © 2011-2022 走看看