yang97

软件工程课后作业1:三十道四则运算题目

三十道四则运算题

使用语言:C#

使用软件:Microsoft Visual Studio

代码语言:

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>

int main(int argc, char **argv)
{
    int a[30],b[30]; 
    int i,c,d;
    
    srand((unsigned int)time(NULL));
    for (i = 0; i < 30; i++)
    {   
        a[i] = rand()%101; 
b[i] = rand()%101;
        printf("%d......%d+%d=\n", i+1,a[i],b[i]);
    }   
printf("按任意键查看答案");
getchar();
for (i = 0; i < 30; i++)
    {   
        
        printf("%d......%d+%d=%d\n", i+1,a[i],b[i],a[i]+b[i]);
    }

getchar();
    return 0;
}

运行结果:当输入取值范围和题目数后,点击“显示”,在下方会出现30道四则运算题目,点击“清屏”,所有的窗口都为空白,以便下次输入,点检“退出”,将会退出程序。

分类:

技术点:

相关文章:

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