码迷,mamicode.com
首页 > 其他好文 > 详细

二柱子的疑难杂症

时间:2018-10-08 19:38:04      阅读:198      评论:0      收藏:0      [点我收藏+]

标签:print   png   main   res   div   clu   ret   http   char   

 #include <stdio.h>

#include <stdlib.h>

#include <time.h>

int main() { 

int i;

    int num1, num2;

    int  op,result, score=0;

    char oper[]={‘+‘,‘-‘,‘*‘,‘/‘};

    srand(time(0));



    for(i=0; i<30; i++)

    {

        printf("第%d题 ", i+1);

        num1 = rand()%101;

        num2 = rand()%101;

        op = rand()%4;

        switch(op){

            case 0:

            printf("%d %c %d = \n", num1, oper[op], num2);

              break;

            case 1:

             printf("%d %c %d = \n", num1, oper[op], num2);

               break;

            case 2:

              printf("%d %c %d = \n", num1, oper[op], num2);

                break;

            case 3:

              printf("%d %c %d = \n", num1, oper[op], num2);

              break;

        }

}    

    return 0;

技术分享图片

 

二柱子的疑难杂症

标签:print   png   main   res   div   clu   ret   http   char   

原文地址:https://www.cnblogs.com/980412peanut/p/9756165.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!