四则运算(c语言)
|这个作业属于哪个课程| https://edu.cnblogs.com/campus/ahgc/AHPU-SE-19/ |
| 这个作业要求在哪里 | https://edu.cnblogs.com/campus/ahgc/AHPU-SE-19/homework/11376 |
|作业目标 | 写一个能自动生成小学四则运算题目的程序 |
|学号 | 3190704109 |
源代码:
include<stdio.h>
include<math.h>
include<windows.h>
int right=0;
int wrong=0;
void add()
{
int a,b,c;
a=rand()%100;
b=rand()%100;
printf("请回答:\n\t\t %d + %d = ",a,b);
scanf("%d",&c);
if(a+bc)
{
printf("回答正确!\n");
right++;
}
else
{
printf("回答错误!\n");
wrong++;
}
}
void minu()
{
int a,b,c;
a=rand()%100;
b=rand()%100;
printf("请回答:\n\t\t %d - %d = ",a,b);
scanf("%d",&c);
if(a-bc)
{
printf("回答正确!\n");
right++;
}
else
{
printf("回答错误!\n");
wrong++;
}
}
void mul()
{
int a,b,c;
a=rand()%100;
b=rand()%100;
printf("请回答:\n\t\t %d * %d = ",a,b);
scanf("%d",&c);
if(a*bc)
{
printf("回答正确!\n");
right++;
}
else
{
printf("回答错误!\n");
wrong++;
}
}
void di()
{
int a,b,c;
a=rand()%100;
b=rand()%100;
printf("请回答:\n\t\t %d / %d = ",a,b);
scanf("%d",&c);
if(a/bc)
{
printf("回答正确!\n");
right++;
}
else
{
printf("回答错误!\n");
wrong++;
}
}
void main()
{
int choise;
int con=0;
printf("\n\t\t\t欢迎进入小学简易四则运算\n\n");
while(1)
{
printf("请选择:\n");
printf("\t\t\t 加法运算(请输入1)\n");
printf("\t\t\t 减法运算(请输入2)\n");
printf("\t\t\t 乘法运算(请输入3)\n");
printf("\t\t\t 除法运算(请输入4)\n");
printf("\t\t\t 退出运算(请输入5)\n");
if(con0)
scanf("%d",&choise);
switch(choise)
{
case 1:
add();
break;
case 2:
minu();
break;
case 3:
mul();
break;
case 4:
di();
break;
case 5:
return;
}
printf("\n\t\t\t继续运算?(请输入1)\n");
printf("\n\t\t\t重新选择?(请输入2)\n");
printf("\n\t\t\t退出运算?(请输入3)\n");
scanf("%d",&con);
if(con1)
con=1;
else if(con2)
con=0;
else if(con3)
break;
else
printf("抱歉!,你输入的指令有误!请重新输入!\n");
}
printf("您总共完成了 %d 道题\n正确 %d 道\n错误 %d 道\n",right+wrong,right,wrong);
}
psp2.1 | 任务内容 | 计划完成需要的时间(min) | 实际完成需要的时间(min) |
---|---|---|---|
Planning | 计划 | 10 | 5 |
Estimate | 估计这个任务需要多少时间,并规划大致工作步骤 | 10 | 12 |
Development | 开发 | 100 | 90 |
Analysis | 需求分析(包括学习新技术) | 10 | 15 |
Design Spec | 生成设计文档 | 5 | 8 |
Design Review | 设计复审 | 5 | 7 |
Coding Standard | 代码规范 | 5 | 7 |
Design | 具体设计 | 5 | 7 |
Coding | 具体编码 | 10 | 8 |
Code Review | 代码复审 | 40 | 45 |
Test | 测试(自我测试,修改代码,提交修改) | 10 | 12 |
Reporting | 报告 | 10 | 15 |
Test Report | 测试报告 | 5 | 7 |
Size Measurement | 计算工作量 | 5 | 6 |
Postmortem & Process Improvement Plan | 事后总结,并提出过程改进计划 | 5 | 3 |