diff --git a/main.c b/4545.c similarity index 61% rename from main.c rename to 4545.c index a2fa339..832d968 100644 --- a/main.c +++ b/4545.c @@ -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(b50) { 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"); @@ -59,6 +63,6 @@ int main() else if(fenshu<70&&fenshu>=60) printf("PASS\n"); else - printf("TRY AGAIN\n"); //判断等级 + printf("TRY AGAIN\n"); //判断等级 return 0; }