四则运算30

#include<stdio.h>
  #include<Windows.h>
  #include<time.h>
  void main()
  {
      int a, b, c, d,i,n;
      srand(unsigned( time(NULL)));
      for (i = 0; i < 30; i++)
      {
          a=rand()%100;
          b=rand()%100;
          c=rand()%4;
switch (c)
         {
         case 0: printf("%d+%d=\n",a,b);
             break;
         case 1:if (a<b)
         {
             d=a;
             a=b;
             b=d;
         }
             printf("%d-%d=\n",a,b);
         break;
         case 2:
             printf("%d*%d=\n",a,b);
         break;
         case 3:
             while (b==0)
             {
                 b=rand()%100;
             }
             printf("%d/%d=\n",a,b);
}   
      }
      system("pause");
      }
    

 

 

posted @ 2018-10-10 23:26  土1603-3李子木  阅读(30)  评论(0)    收藏  举报