C语言寒假大作战02

问题 答案
这个作业属于哪个课程 https://edu.cnblogs.com/campus/zswxy/CST2019-4/
这个作业的要求在哪里 https://edu.cnblogs.com/campus/zswxy/CST2019-4/homework/10259
我在这个课程的目标是 成功掌握C语言这项博大精深的学科
这个作业在具体哪个方面帮助我实现目标 能够让我更熟悉C语言这门学科
参考文献 https://baijiahao.baidu.com/s?id=1616367741584583839&wfr=spider&for=pc

2.2.2 设计思路和遇到的问题

设计思路

  • 通过作业所给的要求利用上个学期所学的编程知识,再结合函数构思去完成这个菜单栏的题目。

遇到的问题

  • 好久没编程,手生了,导致一些小问题频频发生,这告诉我还是要多练习。

    2.2.3 程序结果截图

    C语言寒假大作战02
    C语言寒假大作战02
    C语言寒假大作战02
    C语言寒假大作战02
    C语言寒假大作战02

2.2.4 程序代码

```

include <stdio.h>

include<stdlib.h>

include<time.h>

void menu();
void help();
void error();
void operation_1();void one_1();
void operation_2();void two_1();
void operation_3();void three_1();

int main()
{
int n;
printf("========== 口算生成器 ==========\n欢迎使用口算生成器 :\n潞水小学期中考试\n");
printf("\n");
help();
while(1)
{
menu();
scanf("%d",&n);
switch(n)
{
case 1:operation_1();break;
case 2:operation_2();break;
case 3:operation_3();break;
case 4:help();break;
}
printf("\n");
if(n==5) break;
if(n>5||n<1) error();
}
return 0;
}
void help()
{
printf("帮助信息\n您需要输入命令代号来进行操作, 且\n");
printf("一年级题目为十位数以内的加减法;\n二年级题目为百位数以内的乘除法;\n");
printf("三年级题目为百位数以内的加减乘除混合题目.\n");
printf("\n");
}
void menu()
{
printf("操作列表:\n1)一年级 2)二年级 3)三年级\n4)帮助 5)退出程序\n请输入代号:");
}
void error()
{
printf("宝贝,请重新输入正确数值。");
printf("\n");
printf("\n");
}
void operation_1()
{
printf("一年级题目如下:\n");
printf("\n");
one_1();
}
void operation_2()
{
printf("二年级题目如下:\n");
printf("\n");
two_1();
}
void operation_3()
{
printf("三年级题目如下:\n");
printf("\n");
three_1();
}
void one_1()
{
int a,b,c;
srand((unsigned)time(NULL));
for(int i=1;i<=10;i++)
{
a=rand()%10+1;
b=rand()%10+1;
c=rand()%2;
if(c==0)
printf("%2d + %2d = ",a,b);
else
printf("%2d - %2d =
",a,b);
printf("\n");
}
}
void two_1()
{
int a,b,c;
srand((unsigned)time(NULL));
for(int i=1;i<=10;i++)
{
a=rand()%100;
b=rand()%100;
c=rand()%2;
if(c==0)
printf("%3d * %3d = ",a,b);
else
printf("%3d / %3d =
",a,b);
printf("\n");
}
}
void three_1()
{
int a,b,c;
srand((unsigned)time(NULL));
for(int i=1;i<=10;i++)
{
a=rand()%100;
b=rand()%100;
c=rand()%4;
switch(c)
{
case 0:printf("%3d + %3d = ",a,b);break;
case 1:printf("%3d - %3d =
",a,b);break;
case 2:printf("%3d * %3d = ",a,b);break;
case 3:printf("%3d / %3d =
",a,b);break;
}
printf("\n");
}
}

2.2.5 你对“设计”这个词的理解

*设计是把一种设想通过合理的规划、周密的计划、通过各种感觉形式传达出来的过程,也称为“有目的的创作行为”。

2.2.6 Gitee上传截图与链接

C语言寒假大作战02
C语言寒假大作战02

主页地址

https://gitee.com/you_wake_up_like_a_dream

上一篇:Error disabling address space randomization: Operation not permitted


下一篇:Markdown写出高大上流程图