|
|
@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
#include<stdio.h>
|
|
|
|
|
|
|
|
#include<time.h>
|
|
|
|
|
|
|
|
#include<stdlib.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int question( int i)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int a,b,j,m;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for( i = i;i<100;i++ )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
a=rand()%51;
|
|
|
|
|
|
|
|
b=rand()%51;//rand()%100表示取50以内的随机数
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
j=rand()%2;//j的值决定加减法
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(j==0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
m=a+b;
|
|
|
|
|
|
|
|
if(m<=50)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("%d+%d=\n",a,b);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(m>50) continue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
m=a-b;
|
|
|
|
|
|
|
|
if(m<=50&&m>=0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("%d-%d=\n",a,b);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(m>50) continue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return m;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int ordinal=1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char str[10];
|
|
|
|
|
|
|
|
int score[3]={10,7,5};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
printf("============================================================\n");
|
|
|
|
|
|
|
|
printf("====================50以内加减法检测系统====================\n");
|
|
|
|
|
|
|
|
printf("============================================================\n");
|
|
|
|
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("请输入你的名字:\n");
|
|
|
|
|
|
|
|
scanf("%s",str);
|
|
|
|
|
|
|
|
printf("\n你好呀,%s小朋友,欢迎进入50以内加减法检测系统。\n",str);
|
|
|
|
|
|
|
|
printf("每道题你有三次答题机会,如果三次机会结束则直接给出正确答案。\n");
|
|
|
|
|
|
|
|
printf("\n测试结束后会给出你的成绩以及相应评级。\n");
|
|
|
|
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
printf("======================要注意细心哦~=========================\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("第一道题:\n\n");
|
|
|
|
|
|
|
|
question(1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|