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.

197 lines
3.2 KiB

6 years ago
#include"main.h"
test(int v){ //<2F><><EFBFBD><EFBFBD><E9BAAF>
date max;
int a,b;
int sign;
int scores=0;
int ran=100;
int sta=0;
double time;
char question[22],wro_set[222];
char truth[11],answer[11];
if(range==1) ran=1000;
clock_t start,end;
printf("\n\n\n\n\n\n");
for(int i=3;i>0;i--){
printf("\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%d<><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ\n\n",i); if(voice==1) printf("\a");
sleep(1);
}
system("cls");
start=clock();
for(int i=0;i<10;i++){ //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
printf("\n\n\n\n\n\n\n\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>exitֱ<EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
if(kind==0){
do{
a=rand()%(ran-ran/10)+ran/10+1;
b=rand()%(ran-ran/10)+ran/10+1;
sign=rand()%2;
if(sign==0) sign=-1;
}while((a+sign*b)<ran/10||(a+sign*b)>ran);
sprintf(truth,"%d",a+sign*b);
if(sign==1) sprintf(question,"\n\n\t\t\t<EFBFBD><EFBFBD>%-2d<32><64>:%d+%d=",i+1,a,b);
if(sign==-1) sprintf(question,"\n\n\t\t\t<EFBFBD><EFBFBD>%-2d<32><64>:%d%d=",i+1,a,-1*b);
}else{
do{
a=rand()%(ran-4)+3;
b=rand()%(ran-4)+3;
sign=rand()%2;
if(sign==0){
if((a/b)>=3&&(a/b)<=ran&&(a%b==0))
break;
}else{
if((a*b)>=10&&(a*b)<=ran)
break;
}
}while(1);
if(sign==0) sprintf(truth,"%d",a/b);
else sprintf(truth,"%d",a*b);
if(sign==0) sprintf(question,"\n\n\t\t\t<EFBFBD><EFBFBD>%-2d<32><64>:%d/%d=",i+1,a,b);
else sprintf(question,"\n\n\t\t\t<EFBFBD><EFBFBD>%-2d<32><64>:%d*%d=",i+1,a,b);
}
printf("%s",question);
for(int j=2;j>=0;j--){
printf("\n\n\t\t\t<EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
scanf("%s",&answer); if(voice==1) printf("\a");
if((strcmp(answer,"exit"))==0) goto exit;
if((strcmp(answer,truth))==0){
if(j==2) scores+=10;
if(j==1) scores+=7;
if(j==0) scores+=5;
printf("\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ\n\n");
break;
}else{
printf("\t\t\t<EFBFBD>𰸴<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%d<>λ<EFBFBD><CEBB><EFBFBD>",j);
if(j==0){
sta=1;
strcat(wro_set,question);
strcat(wro_set,truth);
}
}
}
system("cls");
}
end=clock();
time=(float)(end-start)/CLK_TCK;
if(sta==1){
system("cls");
printf("\n\n\n\n\n\n\t\t\t<EFBFBD><EFBFBD><EFBFBD>β<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%s",wro_set);
printf("\n\n\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
getch();
system("cls");
}
printf("\n\n\n\n\n\n\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ijɼ<EFBFBD><EFBFBD>ǣ<EFBFBD>\n\n\t\t\t%d<><64> ",scores);
switch(scores/10){ //<2F>ȼ<EFBFBD><C8BC>ж<EFBFBD>
case 10:{
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
break;
}
case 9:{
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
break;
}
case 8:{
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
break;
}
case 7:
case 6:{
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
break;
}
default :{
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
break;
}
}
printf(" <20><>ʱ%.2f<EFBFBD><EFBFBD>\n\n",time);
printf("\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֺ󷵻ز˵<EFBFBD>\n\n");
printf("\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֣<EFBFBD>");
scanf("%s",&dates[dif][10].name); if(voice==1) printf("\a");
dates[dif][10].scores=scores;
dates[dif][10].time =time;
for(int i=0;i<10;i++){
max=dates[dif][i];
for(int j=i+1;j<11;j++){
if(max.scores<dates[dif][j].scores){
max =dates[dif][j];
dates[dif][j]=dates[dif][i];
dates[dif][i]=max;
}
if(max.scores==dates[dif][j].scores){
if(max.time>dates[dif][j].time){
max =dates[dif][j];
dates[dif][j]=dates[dif][i];
dates[dif][i]=max;
}
}
}
}
exit:
system("cls");
}