commit 14946fef9417572bec0e28cc70ca802a8149cd81 Author: 18408000505@stu.hut.edu.cn <18408000505@stu.hut.edu.cn> Date: Mon Jan 7 14:54:53 2019 +0800 first commit diff --git a/未命名1.cpp b/未命名1.cpp new file mode 100644 index 0000000..373336c --- /dev/null +++ b/未命名1.cpp @@ -0,0 +1,79 @@ +/*2㷨--Apxar*/ +/*2㷨--Apxar*/ +#include +#include +#include +int main(void) +{ + +int i,j,k=2,num1,num2,sum=0,answer,score=0,xiabiao,temp; + char fuhao[2]={'+','-'}; + srand((int)time(0)); + + for(i=1;i<=10;i++) + { + +xiabiao=rand()%2; + num1=rand()*50/32767; + num2=rand()*50/32767; +if(xiabiao==0) +{ sum=num1+num2;} + else +{ sum=num1-num2;} + + if(sum>=0&&sum<=50) +{ +j=2; k=1; + + printf("\n(%d).\n",i); + printf("%7d\n",num1); + printf("%c\n",fuhao[xiabiao]); + printf("%7d\n",num2); + printf("------------\n"); + printf("ȷ "); + scanf("%d",&answer); + + if(sum==answer) + + { + printf("\n:Ĵȷ! \n\n"); + score+=10; + } + + else + { + while(j<=3) +{ + printf("\n𰸴,:"); + scanf("%d",&answer); +if(sum==answer) + { +printf("\n:Ĵȷ! \n\n"); +k++; + +if(k==2) +{ score+=7;} + else if(k==3) +{ score+=5;} + + break; + +} + else + + { k++;} + j++; + +} + if(j>3) +printf("\nȷΪ:%d\n",sum); + +} + +} + else + + i--; + } + printf("\n%dĿ,ܷΪ%d\n \n",i-1,score); +} diff --git a/未命名1.exe b/未命名1.exe new file mode 100644 index 0000000..77c81c6 Binary files /dev/null and b/未命名1.exe differ