You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
1.6 KiB

6 years ago
#include"stdio.h"
#include"stdlib.h" //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD>//
#include"time.h" //ʱ<><EFBFBD><E4BAAF>ͷ<EFBFBD>ļ<EFBFBD>//
int add(int j,int x, int y); //<2F>ӷ<EFBFBD><D3B7><EFBFBD><EFBFBD><EFBFBD>//
void sub(int j,int x, int y); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>//
int sum=0; //<2F><>¼<EFBFBD>÷<EFBFBD>//
int pd(int result) //*<2A>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ȷ <20><>ȷ <20><><EFBFBD><EFBFBD>1 <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>-1*//
{ int n;
scanf("%d",&n);
if(result==n)
return 1;
return -1;
}
void jifen(int result) //<2F><><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ֣<C7B7><D6A3>ۼӵ<DBBC>sum//
{
if(pd(result)==1)
sum+=10;
else
{
printf("\n<EFBFBD>𰸴<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:"); //<2F><>һ<EFBFBD><D2BB> //
if(pd(result)==1)
sum+=7;
else
{
printf("\n<EFBFBD>𰸴<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:"); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>//
if(pd(result)==1)
sum+=5;
else
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>:\n"); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>//
}
}
}
int main()
{
int i,x,y,ch,z;
srand(time(NULL));//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>//
printf("Сѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
for(i=0;i<10;i++)
{
x=rand()%51;
y=rand()%51;
ch=rand()%2;
switch(ch)
{
case 0: z=add(i+1,x,y);
if(z==1) //<2F><><EFBFBD>³<EFBFBD>һ<EFBFBD><D2BB>//
i=i-1;
break;
case 1: sub(i+1,x,y);
break;
default:
6 years ago
printf("ϵͳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
6 years ago
}
}
6 years ago
printf("<EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>%d",sum);
6 years ago
if(sum>=90&&sum<=100)
6 years ago
printf("SMART");
6 years ago
else if(sum>=80)
printf("GOOD");
else if(sum>=70)
printf("OK");
else if(sum>=60)
printf("PASS");
else if(sum>=0)
printf("TRY AGAIN");
else
printf("ϵͳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
return 0;
}
int add(int j,int x,int y)
{
int result;
result=x+y;
if(result>50) //<2F>ж<EFBFBD><D0B6>Ƿ񳬳<C7B7><F1B3ACB3><EFBFBD>Χ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1//
return 1;
printf("%d:%d+%d=",j,x,y);
jifen(result);
return -1;
}
void sub(int j,int x,int y)
{
int result,t;
if(x<y) //<2F><>֤<EFBFBD><D6A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0//
{
t=x; x=y ; y=t;
}
result=x-y;
printf("%d:%d-%d=",j,x,y);
jifen(result);
6 years ago
}