|
|
@ -0,0 +1,250 @@
|
|
|
|
|
|
|
|
#include<stdio.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include<stdlib.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include<time.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//定义习题结构
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct test{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char fuhao;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int a; //其中一个加数或者减数
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int b; //另一个加数或者减数
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int rezult; //两数只差或者两数之和
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}qst[10]; //10道题目question
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void jiemian(); //界面
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void xitong(); //系统生成题目
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int dati(); //学生答题模块
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void pingjia(); //最终评价
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
jiemian();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
xitong();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pingjia();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//界面
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void jiemian()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int kind; //是否开始考试
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("此测验适用于小学1、2年级\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("-----------------------------\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("如果准备好请按 1 开始答题\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("-----------------------------\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scanf("%d",&kind);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while(kind!=1)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("输入错误,请重新输入1\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scanf("%d",&kind);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("系统正在自动生成题目\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("-----------------------------\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("祝你测试愉快!\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("-----------------------------\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("现在开始答题\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("---------------------\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//系统生成题目
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void xitong()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int a; //a为随机一个数,用来判断做加法还是减法
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int b,c; //b,c为加数减数
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int i; //次数
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
srand(time(NULL));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(i=0;i<10;i++){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
a=rand();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
b=rand()%51;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
c=rand()%51;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(a%2==0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
qst[i].fuhao='+';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while(b+c>50)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
b=rand()%51; //判断两数之和是否超纲
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
c=rand()%51;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
qst[i].fuhao='-';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(b<c)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int t;
|
|
|
|
|
|
|
|
t=b;
|
|
|
|
|
|
|
|
b=c;
|
|
|
|
|
|
|
|
c=t; //将大数置为被减数,小数位减数
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
qst[i].a=b;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
qst[i].b=c;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(a%2==0) qst[i].rezult=b+c;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else qst[i].rezult=b-c;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* for(i=0;i<10;i++)
|
|
|
|
|
|
|
|
printf("第%d题为;%d%c%d=\n\n",i+1,qst[i].a,qst[i].fuhao,qst[i].b); */
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//学生答题模块
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int dati()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int i; //循环次数
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int stuanswer; //学生答案
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int count=3; //每题的可答题次数
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int grade=0; //学生成绩
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(i=0;i<10;i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("第%d题为;%d%c%d=\n",i+1,qst[i].a,qst[i].fuhao,qst[i].b);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scanf("%d",&stuanswer);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(stuanswer==qst[i].rezult)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("恭喜你答对了!\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while(stuanswer!=qst[i].rezult&&count>0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("很遗憾你答错了\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
count--;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(count==0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
printf("你还有%d次机会\n",count);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("请重新输入你的答案: ");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scanf("%d",&stuanswer);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
switch(count)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("很遗憾此题你没有得到分数\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("此题的正确答案为 %d\n",qst[i].rezult); break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("此题你得到分数的分数为5分\n"); grade+=5; break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("此题你得到分数的分数为7分\n"); grade+=7; break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("此题你得到分数的分数为10分\n"); grade+=10; break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("你目前的总分为%d\n\n",grade);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
count=3; //重置计数次数
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return grade; //返回最终成绩进行判断
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//最终评价
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void pingjia()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int grade;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
grade=dati();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("你的总分为%d\n",grade);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("你最终的评价;\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
grade/=10;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch(grade){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case(10):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case(9):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("SMART\n"); break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case(8):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("GOOD\n"); break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case(7):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("OK\n"); break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case(6):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("PASS\n"); break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("TRY AGAIN\n"); break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|