|
|
@ -9,13 +9,16 @@ int sjfu()
|
|
|
|
int main()
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
char a[]={'+','-'};
|
|
|
|
char a[]={'+','-'};
|
|
|
|
int b,c,d,t,i,j,f;
|
|
|
|
int b,c,d,t,i,j,f,su=0;
|
|
|
|
int daan,fenshu=0;
|
|
|
|
int daan,fenshu=0;
|
|
|
|
|
|
|
|
printf("--------------------------------------------------------------\n");
|
|
|
|
|
|
|
|
printf("\n\t请输入以下10个计算题的答案\n\t(别着急,每个题有三次输入的机会哦)\n\n");
|
|
|
|
|
|
|
|
printf("--------------------------------------------------------------\n\n");
|
|
|
|
for(i=0;i<10;i++)
|
|
|
|
for(i=0;i<10;i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
srand( (unsigned)time( NULL ));
|
|
|
|
srand( (unsigned)time( NULL ));
|
|
|
|
b=rand()%50;
|
|
|
|
b=rand()%51;
|
|
|
|
c=rand()%50;
|
|
|
|
c=rand()%51;
|
|
|
|
d=sjfu();
|
|
|
|
d=sjfu();
|
|
|
|
if(b<c)
|
|
|
|
if(b<c)
|
|
|
|
{ t=b;b=c;c=t;}
|
|
|
|
{ t=b;b=c;c=t;}
|
|
|
@ -28,8 +31,9 @@ int main()
|
|
|
|
|
|
|
|
|
|
|
|
if(daan>50)
|
|
|
|
if(daan>50)
|
|
|
|
{ i-=1;continue;} //ÅжÏËãʽÊÇ·ñ·ûºÏÒªÇó
|
|
|
|
{ i-=1;continue;} //ÅжÏËãʽÊÇ·ñ·ûºÏÒªÇó
|
|
|
|
|
|
|
|
su=i;
|
|
|
|
printf("\t%d%c%d=?\n",b,a[d],c); //形成随机算式,并输出
|
|
|
|
printf("第%d题\n",su+1);
|
|
|
|
|
|
|
|
printf("\t%d%c%d=?\n\n",b,a[d],c); //输出算式题
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(j=0;j<3;j++)
|
|
|
|
for(j=0;j<3;j++)
|
|
|
@ -38,17 +42,17 @@ int main()
|
|
|
|
if(f==daan)
|
|
|
|
if(f==daan)
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
else
|
|
|
|
else
|
|
|
|
printf("答案不对哦,再想想看~\n");
|
|
|
|
printf("答案不对哦,再想想看\n");
|
|
|
|
} //用户输入答案
|
|
|
|
} //用户输入答案(三次机会)
|
|
|
|
|
|
|
|
|
|
|
|
switch(j)
|
|
|
|
switch(j)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
case 0:{fenshu+=10;break;}
|
|
|
|
case 0:{fenshu+=10;break;}
|
|
|
|
case 1:{fenshu+=7;break;}
|
|
|
|
case 1:{fenshu+=7;break;}
|
|
|
|
case 2:{fenshu+=5;break;}
|
|
|
|
case 2:{fenshu+=5;break;}
|
|
|
|
case 3:{fenshu+=0;printf("%d\n",daan);break;}
|
|
|
|
case 3:{fenshu+=0;printf("\n\t很可惜\n\t正确答案是 %d\n",daan);break;}
|
|
|
|
} //判断得分或输出该算式答案
|
|
|
|
} //判断输出该算式答案,并计算得分
|
|
|
|
|
|
|
|
printf("\n--------------------------------------------------------------\n\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(fenshu>=90)
|
|
|
|
if(fenshu>=90)
|
|
|
|
printf("SMART\n");
|
|
|
|
printf("SMART\n");
|