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