From 47114d1c03d1ffd5057375150cb459af6e872637 Mon Sep 17 00:00:00 2001 From: AQ123456789 <630395495@qq.com> Date: Fri, 11 Jan 2019 12:14:36 +0800 Subject: [PATCH] third commit --- main.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 main.c diff --git a/main.c b/main.c new file mode 100644 index 0000000..a2fa339 --- /dev/null +++ b/main.c @@ -0,0 +1,64 @@ +#include +#include +#include + +int sjfu() +{ srand( (unsigned)time( NULL )); + return rand()%2; +} +int main() +{ + char a[]={'+','-'}; + int b,c,d,t,i,j,f; + int daan,fenshu=0; + for(i=0;i<10;i++) + { + srand( (unsigned)time( NULL )); + b=rand()%50; + c=rand()%50; + d=sjfu(); + if(b50) + { i-=1;continue;} //判断算式是否符合要求 + + printf("\t%d%c%d=?\n",b,a[d],c); //形成随机算式,并输出 + + + for(j=0;j<3;j++) + { + scanf("%d",&f); + if(f==daan) + break; + else + 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;} + } //判断得分或输出该算式答案 + + } + if(fenshu>=90) + printf("SMART\n"); + else if(fenshu<90&&fenshu>=80) + printf("GOOD\n"); + else if(fenshu<80&&fenshu>=70) + printf("OK\n"); + else if(fenshu<70&&fenshu>=60) + printf("PASS\n"); + else + printf("TRY AGAIN\n"); //判断等级 + return 0; +}