|
|
|
@ -1,9 +1,11 @@
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include<stdlib.h>
|
|
|
|
|
#include<time.h>
|
|
|
|
|
|
|
|
|
|
struct Student
|
|
|
|
|
{
|
|
|
|
|
char cSchool[15];
|
|
|
|
|
char cGrade[15];
|
|
|
|
|
char cGrade[15];
|
|
|
|
|
char cName[15];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -16,7 +18,7 @@ int k=0,grade; /*
|
|
|
|
|
|
|
|
|
|
int main()
|
|
|
|
|
{
|
|
|
|
|
struct Student student1;
|
|
|
|
|
struct Student student1;
|
|
|
|
|
printf("****预祝测试顺利****\n\n");
|
|
|
|
|
printf("学校:");
|
|
|
|
|
scanf("%s",&student1.cSchool);
|
|
|
|
@ -24,10 +26,10 @@ int main()
|
|
|
|
|
scanf("%s",&student1.cGrade);
|
|
|
|
|
printf("姓名:");
|
|
|
|
|
scanf("%s",&student1.cName);
|
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
|
|
printf("请回答下面十道题目\n");
|
|
|
|
|
|
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
|
|
printf("请回答下面十道题目\n");
|
|
|
|
|
|
|
|
|
|
do{
|
|
|
|
|
int i=test();
|
|
|
|
|
if(i==-1)
|
|
|
|
@ -39,7 +41,7 @@ int main()
|
|
|
|
|
else if(grade>=70&&grade<80)
|
|
|
|
|
printf("-------OK");
|
|
|
|
|
else if(grade>=60&&grade<70)
|
|
|
|
|
printf("-------PASS");
|
|
|
|
|
printf("-------PASS");
|
|
|
|
|
else
|
|
|
|
|
printf("-------TRY AGAIN");
|
|
|
|
|
break;
|
|
|
|
@ -65,17 +67,17 @@ int test()
|
|
|
|
|
{
|
|
|
|
|
printf("\n所有题目已答完,你的成绩:%d分",grade);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if(c==0)
|
|
|
|
|
{
|
|
|
|
|
printf("第%d题:%d+%d=",k,a,b);
|
|
|
|
|
return a+b;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if(c==1)
|
|
|
|
|
{
|
|
|
|
|
printf("第%d题:%d-%d=",k,a,b);
|
|
|
|
|
return a-b;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -85,41 +87,42 @@ int checknum(int a,int b) /*
|
|
|
|
|
return 0;
|
|
|
|
|
else
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int checkresult(int result)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
for(i=1;i<4;i++)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int checkresult(int result)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
for(i=1;i<4;i++)
|
|
|
|
|
{
|
|
|
|
|
scanf("%d", &x);
|
|
|
|
|
if (x!=result)
|
|
|
|
|
scanf("%d", &x);
|
|
|
|
|
if (x!=result)
|
|
|
|
|
{
|
|
|
|
|
if (i==3)
|
|
|
|
|
if (i==3)
|
|
|
|
|
{
|
|
|
|
|
if (c==0){
|
|
|
|
|
printf("三次回答错误,正确答案是%d\n",a+b);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
printf("三次回答错误,正确答案是%d\n",a-b);
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
printf("回答错误,请再次输入:");
|
|
|
|
|
}
|
|
|
|
|
if (c==0){
|
|
|
|
|
printf("三次回答错误,正确答案是%d\n",a+b);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
printf("三次回答错误,正确答案是%d\n",a-b);
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
printf("回答错误,请再次输入:");
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
switch(i){
|
|
|
|
|
case 1:grade+=10;
|
|
|
|
|
break;
|
|
|
|
|
case 2:grade+=7;
|
|
|
|
|
break;
|
|
|
|
|
case 3:grade+=5;
|
|
|
|
|
break;
|
|
|
|
|
default:grade+=0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
case 1:grade+=10;
|
|
|
|
|
break;
|
|
|
|
|
case 2:grade+=7;
|
|
|
|
|
break;
|
|
|
|
|
case 3:grade+=5;
|
|
|
|
|
break;
|
|
|
|
|
default:grade+=0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|