#include<stdio.h>
#include<stdlib.h>
main()
{
 int i,b,c,d,n;
 char a[4]={'+','-','*','/'};
 printf("请输入需要四则运算的题数:");
 scanf("%d",&n);
 for(i=1;i<=n;i++)
 {
  b=rand()%4;
  c=rand()%100;
  d=rand()%100;
  printf("%d%c%d=\t\t",c,a[b],d);
  if(i%4==0)
  {
   printf("\n");
  }
 }
 printf("\n");
}

    通过编写这段小小的程序,让我想起了刚学习C语言的时候。可遗憾的是,这么简单的程序竟然要通过百度才知道如何生成随机数。看来有时间要看看书了,把基础的东西复习一下才行。

相关文章:

  • 2021-05-16
  • 2021-12-02
  • 2021-08-14
  • 2021-07-05
  • 2021-06-17
  • 2021-12-24
  • 2021-10-14
猜你喜欢
  • 2021-10-01
  • 2022-01-23
  • 2021-08-11
  • 2021-06-29
  • 2021-06-02
相关资源
相似解决方案