二柱子的疑难杂症

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

 

posted @ 2018-10-08 18:47  PeanuTnT  阅读(108)  评论(0)    收藏  举报