|
|
@ -1,23 +1,31 @@
|
|
|
|
#include<stdlib.h>
|
|
|
|
#include<stdlib.h>//控制台背景颜色//
|
|
|
|
#include<stdio.h>
|
|
|
|
#include<stdio.h>
|
|
|
|
#include<math.h>
|
|
|
|
#include<math.h>
|
|
|
|
int main()
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int zf,a,b,c,i,j,n,count,sum=0;
|
|
|
|
int zf,a,b,c,i,j,n,count,sum=0;
|
|
|
|
srand(time(NULL));
|
|
|
|
srand(time(NULL));
|
|
|
|
printf("测验现在开始,请认真答题\n");
|
|
|
|
printf("测验现在开始,请认真答题,准备好后请按任意键开始出题\n");
|
|
|
|
|
|
|
|
system("color f4");
|
|
|
|
|
|
|
|
system("pause");
|
|
|
|
for(i=1;i<=10;i++)
|
|
|
|
for(i=1;i<=10;i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
count=10;//每题的分数//
|
|
|
|
count=10;//每题的分数//
|
|
|
|
a=rand()%26;//产生一个0到25的数//
|
|
|
|
a=rand()%51;//产生一个0到50的数//
|
|
|
|
b=rand()%26;
|
|
|
|
b=rand()%51;
|
|
|
|
if(a<b)
|
|
|
|
if(a<b)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
c=a;
|
|
|
|
c=a;
|
|
|
|
a=b;
|
|
|
|
a=b;
|
|
|
|
b=c;
|
|
|
|
b=c;
|
|
|
|
}//a一定要比b大,这样无论加法还是减法都不会有负数出现//
|
|
|
|
}//a一定要比b大,这样无论加法还是减法都不会有负数出现//
|
|
|
|
zf=rand()%2;//产生0或1的随机数//
|
|
|
|
if(a+b>50)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
i--;
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("第%d题",i);
|
|
|
|
|
|
|
|
zf=rand()%2;//产生0或1的随机数//
|
|
|
|
if(zf==0)//为0则执行加法//
|
|
|
|
if(zf==0)//为0则执行加法//
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("%d+%d=",a,b);
|
|
|
|
printf("%d+%d=",a,b);
|
|
|
@ -28,9 +36,9 @@ int main()
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("重新输入\n");
|
|
|
|
printf("你答错了,再给你%d次机会\n",(j-1));
|
|
|
|
scanf("%d",&n);
|
|
|
|
scanf("%d",&n);
|
|
|
|
count=count-j;
|
|
|
|
count=count-j;//第一次做错减3分,第二次做错减2分//
|
|
|
|
if(n==a+b)
|
|
|
|
if(n==a+b)
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -38,7 +46,7 @@ int main()
|
|
|
|
if(j==1)
|
|
|
|
if(j==1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
count=0;
|
|
|
|
count=0;
|
|
|
|
printf("%d\n",a+b);
|
|
|
|
printf("没有机会了,正确答案是%d\n",a+b);
|
|
|
|
}//执行了三次的话分数为0//
|
|
|
|
}//执行了三次的话分数为0//
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else//执行减法//
|
|
|
|
else//执行减法//
|
|
|
@ -51,9 +59,9 @@ int main()
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("重新输入");
|
|
|
|
printf("你答错了,再给你%d次机会\n",(j-1));
|
|
|
|
scanf("%d",&n);
|
|
|
|
scanf("%d",&n);
|
|
|
|
count=count-j;//第一次减3第二次减2//
|
|
|
|
count=count-j;//第一次做错减3分,第二次做错减2分//
|
|
|
|
if(n==a-b)
|
|
|
|
if(n==a-b)
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -61,22 +69,22 @@ int main()
|
|
|
|
if(j==1)
|
|
|
|
if(j==1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
count=0;
|
|
|
|
count=0;
|
|
|
|
printf("%d\n",a-b);
|
|
|
|
printf("没有机会了,正确答案是%d\n",a-b);
|
|
|
|
}
|
|
|
|
}//执行了三次的话分数为0//
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sum+=count;//加上每题的分数//
|
|
|
|
sum+=count;//加上每题的分数//
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("你的分数是%d\n",sum);
|
|
|
|
if(sum>90)
|
|
|
|
if(sum>90)
|
|
|
|
printf("SMART");
|
|
|
|
printf("你的等级是SMART\n");
|
|
|
|
else if(sum>80)
|
|
|
|
else if(sum>80)
|
|
|
|
printf("GOOD");
|
|
|
|
printf("你的等级是GOOD\n");
|
|
|
|
else if(sum>70)
|
|
|
|
else if(sum>70)
|
|
|
|
printf("OK");
|
|
|
|
printf("你的等级是OK\n");
|
|
|
|
else if(sum>60)
|
|
|
|
else if(sum>60)
|
|
|
|
printf("PASS");
|
|
|
|
printf("你的等级是PASS\n");
|
|
|
|
else
|
|
|
|
else
|
|
|
|
printf("TRY AGAIN");
|
|
|
|
printf("你的等级是TRY AGAIN\n");
|
|
|
|
printf("考试结束\n");
|
|
|
|
printf("考试结束\n");
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|