|
|
|
|
#include<stdlib.h>
|
|
|
|
|
#include<stdio.h>
|
|
|
|
|
#include<conio.h>
|
|
|
|
|
#include<string.h>
|
|
|
|
|
|
|
|
|
|
void main()
|
|
|
|
|
{
|
|
|
|
|
int num=0,add=0; /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܷ<EFBFBD> */
|
|
|
|
|
int score[3]={10,7,5};/*<2A>ü<EFBFBD><C3BC><EFBFBD>*/
|
|
|
|
|
char str[20],str1[10][20];
|
|
|
|
|
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
int a=0,b=0,d=0,c=0,k=0,i=0,j=-1,result;
|
|
|
|
|
char sf[2]={'+','-'};/* <20><><EFBFBD><EFBFBD> */
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
a=rand()%51;/*0-50<35><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
b=rand()%51;/*0-50<35><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
d=rand()%2;/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|
|
|
|
if(d==0)c=a+b;
|
|
|
|
|
else c=a-b;
|
|
|
|
|
if(c>=0 && c<=50)/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD>³<EFBFBD><C2B3><EFBFBD> */
|
|
|
|
|
{
|
|
|
|
|
sprintf(str,"%d %c %d = \n",a,sf[d],b);
|
|
|
|
|
strcpy(str1[num],str);
|
|
|
|
|
if(num==0) break;
|
|
|
|
|
j=-1;
|
|
|
|
|
for(i=0; i<num; i++)
|
|
|
|
|
{
|
|
|
|
|
if(strcmp(str,str1[i])==0)
|
|
|
|
|
{ j=1;break;}
|
|
|
|
|
}
|
|
|
|
|
if(j<0)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf("%s\n",str);/* <20>ش<EFBFBD> */
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n");
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
scanf("%d",&result);
|
|
|
|
|
k++;
|
|
|
|
|
if(result==c)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD>ش<EFBFBD><EFBFBD><EFBFBD>ȷ!\n");
|
|
|
|
|
add+=score[k-1];
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else if(k<3)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD>»ش<C2BB>:\n");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{ printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD>: %d\n",c);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
num++;
|
|
|
|
|
if(num==10)break;
|
|
|
|
|
}
|
|
|
|
|
if(add>=90)printf("\nSMART\n");
|
|
|
|
|
else if(add>=80)printf("\nGOOD\n");
|
|
|
|
|
else if(add>=70)printf("\nOK\n");
|
|
|
|
|
else if(add>=60)printf("\nPASS\n");
|
|
|
|
|
else printf("\nTRY AGAIN\n");
|
|
|
|
|
getch();
|
|
|
|
|
}
|
|
|
|
|
|