|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
|
|
struct Student
|
|
|
|
|
{
|
|
|
|
|
char cSchool[15];
|
|
|
|
|
char cGrade[15];
|
|
|
|
|
char cName[15];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
int test();
|
|
|
|
|
int checknum(int a,int b);
|
|
|
|
|
int checkresult(int x); /*<2A><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>*/
|
|
|
|
|
|
|
|
|
|
int a=-1,b,c,x;
|
|
|
|
|
int k=0,grade; /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>*/
|
|
|
|
|
|
|
|
|
|
int main()
|
|
|
|
|
{
|
|
|
|
|
struct Student student1;
|
|
|
|
|
printf("****Ԥף<D4A4><D7A3><EFBFBD><EFBFBD>˳<EFBFBD><CBB3>****\n\n");
|
|
|
|
|
printf("ѧУ:");
|
|
|
|
|
scanf("%s",&student1.cSchool);
|
|
|
|
|
printf("<EFBFBD>꼶:");
|
|
|
|
|
scanf("%s",&student1.cGrade);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%s",&student1.cName);
|
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʮ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ\n");
|
|
|
|
|
|
|
|
|
|
do{
|
|
|
|
|
int i=test();
|
|
|
|
|
if(i==-1)
|
|
|
|
|
{
|
|
|
|
|
if(grade>=90)
|
|
|
|
|
printf("-------SMART");
|
|
|
|
|
else if(grade>=80&&grade<90)
|
|
|
|
|
printf("-------GOOD");
|
|
|
|
|
else if(grade>=70&&grade<80)
|
|
|
|
|
printf("-------OK");
|
|
|
|
|
else if(grade>=60&&grade<70)
|
|
|
|
|
printf("-------PASS");
|
|
|
|
|
else
|
|
|
|
|
printf("-------TRY AGAIN");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else if(checkresult(i)==0){
|
|
|
|
|
a=-1;
|
|
|
|
|
}
|
|
|
|
|
}while(k);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int test()
|
|
|
|
|
{
|
|
|
|
|
srand((unsigned int)time(NULL));
|
|
|
|
|
while(checknum(a,b)==0) /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡֵ<C8A1><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>a,bȡֵ*/
|
|
|
|
|
{
|
|
|
|
|
a=rand()%51; /*aȡֵ<C8A1><D6B5>Χ0~50*/
|
|
|
|
|
b=rand()%51; /*bȡֵ<C8A1><D6B5>Χ0~50*/
|
|
|
|
|
c=rand()%2; /*cȡֵ<C8A1><D6B5>Χ0~1*/
|
|
|
|
|
}
|
|
|
|
|
k++; /*k<><6B>ʾ<EFBFBD>ڼ<EFBFBD><DABC><EFBFBD>*/
|
|
|
|
|
if(k==11)
|
|
|
|
|
{
|
|
|
|
|
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD>Ѵ<EFBFBD><EFBFBD>꣬<EFBFBD><EFBFBD><EFBFBD>ijɼ<EFBFBD><EFBFBD><EFBFBD>%d<><64>",grade);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
else if(c==0)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD>%d<><64>:%d+%d=",k,a,b);
|
|
|
|
|
return a+b;
|
|
|
|
|
}
|
|
|
|
|
else if(c==1)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD>%d<><64>:%d-%d=",k,a,b);
|
|
|
|
|
return a-b;
|
|
|
|
|
}
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int checknum(int a,int b) /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӻ<EFBFBD><D3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>*/
|
|
|
|
|
{
|
|
|
|
|
if(a>50||b>50||a<0||b<0||(a+b)>50||(a-b)<0)
|
|
|
|
|
return 0;
|
|
|
|
|
else
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int checkresult(int result)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
for(i=1;i<4;i++)
|
|
|
|
|
{
|
|
|
|
|
scanf("%d", &x);
|
|
|
|
|
if (x!=result)
|
|
|
|
|
{
|
|
|
|
|
if (i==3)
|
|
|
|
|
{
|
|
|
|
|
if (c==0){
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>λش<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%d\n",a+b);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>λش<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%d\n",a-b);
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD>ش<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD>ٴ<EFBFBD><D9B4><EFBFBD><EFBFBD>룺");
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
switch(i){
|
|
|
|
|
case 1:grade+=10;
|
|
|
|
|
break;
|
|
|
|
|
case 2:grade+=7;
|
|
|
|
|
break;
|
|
|
|
|
case 3:grade+=5;
|
|
|
|
|
break;
|
|
|
|
|
default:grade+=0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|