dccmmtop

#include <stdio.h>

 

#include <stdlib.h>

 

#include <time.h>

 
 

int main(void)

 

{

 

  int i = 0;

 

 srand((unsigned)time(NULL)); //本地时间为种子

 

  while(i<30)

 

  {

 

    int a = rand()%100; //产生随机数

 

    int b = rand()%100;

 

    int j;

 

      j = rand()%4; //产生随机符号0到3分别代表四则运算

 

    printf("%d", a);

 

    switch(j)

 

    {

 

      case 0:

 

        printf("+");

 

        break;

 

      case 1:

 

        printf("-");

 

        break;

 

      case 2:

 

        printf("*");

 

        break;

 

      case 3:

 

        printf("/");

 

        break;

 
 

    }

 
 

    printf("%d", b);

 

    printf(" = \n");

 

    i++;

 

  }

 
 

  return 0;

 

}    

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-07-29
  • 2021-08-22
  • 2022-12-23
  • 2022-12-23
  • 2021-11-28
  • 2021-07-22
猜你喜欢
  • 2021-10-01
  • 2021-10-18
  • 2022-12-23
  • 2021-11-13
  • 2021-06-08
  • 2022-02-17
相关资源
相似解决方案