#include"stdio.h"
#include"stdlib.h"
#include"time.h"
int main()
{
while(1)
{
int a,b,c,d,k,type,op;
printf("Please choose the lever!\n1.Easy(0--9)\n2.Hard(10--99)\n");
scanf("%d",&k);
printf("Please choose the type you want!\n");
printf("**********************\n");
printf("*\t1.plus\n*\t2.minus\n*\t3.multiply\n*\t4.divided\n*\t0.exit\n");
printf("**********************\n");
scanf("%d",&type);
if(k==1)
{
a=rand()%10;
b=rand()%10;
}
else
{
a=rand()%100;
b=rand()%100;
}
if(type==0)
{
printf("thank you for using!\n\n");
break;
}
if(type==1)
{
printf("%d+%d=?\n",a,b);
while(1)
{
scanf("%d",&op);
if(a+b==op)
{ printf("Very good! You are rigth! \n\n");
break;
}
else
printf("Sorry,you are wrong!\nPlease again!\n");
}
}
else if(type==2)
{
printf("%d-%d=?\n",a,b);
while(1)
{
scanf("%d",&op);
if(a-b==op)
{ printf("Very good! You are rigth!\n\n");
break;
}
else printf("Sorry,you are wrong!\nPlease again!\n");
}
}
else if(type==3)
{
printf("%d*%d=?\n",a,b);
while(1)
{
scanf("%d",&op);
if(a*b==op)
{
printf("Very good! You are rigth!\n\n");
break;
}
else printf("Sorry,you are wrong!\nPlease again!\n");
}
}
else if(type==4)
{
b=b+1;
printf("%d/%d=? 商几余几\n",a,b);
while(1)
{
scanf("%d%d",&c,&d);
if(c==a/b&&d==a%b)
{
printf("Very good! You are rigth!\n\n");
break;
}
else printf("Sorry,you are wrong!\nPlease again!\n");
}
}
}
return 0;
}
已有 22658 名学员学习以下课程通过考试
最需教育客户端 软件问题一手掌握
去 App Store 免费下载 iOS 客户端
点击加载更多评论>>