C语言自动出十题四则运算,c语言四则运算出题器

《c语言四则运算出题器》由会员分享,可在线阅读,更多相关《c语言四则运算出题器(16页珍藏版)》请在人人文库网上搜索。

1、include#include#includeint a,n,nright=0,nwrong=0,flag5,flag3=1,flag6=0,mark,etime=0,etime1,etime2;char op,choice;void award()char c;if(mark=100) /*输出笑脸等不同奖励*/c=rand()%2+1;printf(%28c %21cn,c,c);c=rand()%2+1;printf(%26c %3c %17c %3cn,c,c,c,c);c=rand()%2+1;printf(%24c %7c %13c %7cn,c,c,c,c);c=rand()%2。

2、+1;printf(nn);printf(nn);printf(%35c %7cn,c,c);c=rand()%2+1;printf(%37c %3cn,c,c);c=rand()%2+1;printf(%39cn,c);else if(mark=90)c=rand()%2+1;printf(%28c %21cn,c,c);c=rand()%2+1;printf(%26c %3c %17c %3cn,c,c,c,c);c=rand()%2+1;printf(%24c %7c %13c %7cn,c,c,c,c);c=rand()%2+1;printf(nn);printf(nn);printf。

3、(%35c %c %c %c %cn,c,c,c,c,c);else if(mark=80)c=rand()%2+1;printf(n);printf(%28c %c %c %c %c %12c %c %c %c %cn,c,c,c,c,c,c,c,c,c,c);printf(n);printf(n);printf(n);c=rand()%2+1;printf(%38c %7cn,c,c);c=rand()%2+1;printf(%40c %3cn,c,c);c=rand()%2+1;printf(%42cn,c);else if(mark=60)c=22;printf(n);printf(%。

4、28c %c %c %c %c %12c %c %c %c %cn,c,c,c,c,c,c,c,c,c,c);printf(n);printf(n);printf(n);printf(n);printf(%38c %c %c %c %cn,c,c,c,c,c);elsec=22;printf(n);printf(%28c %c %c %c %c %12c %c %c %c %cn,c,c,c,c,c,c,c,c,c,c);c=25;printf(%32c %20cn,c,c);printf(%32c %20cn,c,c);printf(%32c %20cn,c,c);printf(%32c %。

5、20cn,c,c);void score(int seconds,int i)int seconds0;seconds0=i*n;if(etime=0)printf(n);elseif(secondsa) /*控制不输出负数*/b=rand()%100+0;a-=b;break;printf(%d,b);op2=rand()%6+42;while(op2!=*)&(op2!=+)&(op2!=-)&(op2!=/)op2=rand()%6+42;printf(%c,op2);flag1+;if(op2=*|op2=/)if(flag1!=0)if(flag2=1) /*判断第一项计算是否为乘除。

6、及前一个运算符为加或减*/a-=b;if(flag2=0)a+=b;if(flag1=0)b=a;e=flag5=0?rand()%10+1:rand()%100+1;switch(op2)case *:if(flag2=0)while(b*e)a) /*控制不输出负数*/e=flag5=0?rand()%10+1:rand()%100+1;b*=e;if(flag2=1)b*=e;break;case /:if(flag2=0)while(b/e)a|(b%e)!=0) /*控制不输出负数及小数*/e=flag5=0?rand()%10+1:rand()%100+1;b/=e;if(flag。

7、2=1)while(b%e)!=0)e=flag5=0?rand()%10+1:rand()%100+1;b/=e;break;printf(%d,e);op2=rand()%6+42;while(op2!=+)&(op2!=-)op2=rand()%6+42;printf(%c,op2);if(flag1!=0) /*根据前一个运算符的加或减来进行后期运算*/if(flag2=1)a+=b;if(flag2=0)a-=b;if(flag1=0)a=b;printf(b=);scanf(%d,&input);judge(input);etime2=time(0);int jiajian()in。

8、t flag4,b,input,d;flag4=rand()%2+1;etime=flag5=0?2:4; /*输出每道题所需时间*/switch(flag4)case 1:d=flag5=0?rand()%10+1:rand()%100+1; /*随机输出混合式长度*/b=flag5=0?rand()%10+1:rand()%100+1;a=d+b;printf(%d+%d=,d,b);scanf(%d,&input);break;case 2:dod=flag5=0?rand()%10+1:rand()%100+1; /*随机输出混合式长度*/b=flag5=0?rand()%10+1:r。

9、and()%100+1;while(d-b52) /*任意键退出*/printf(A、继续nB、退出游戏n);op=getchar();op=getchar();if(op=a|op=A)op=a;flag6=1;else if(op=b|op=B)return 0;elseop=a;printf(请重新选择n);flag6=1;doif(flag6=0)op=m;switch(mode)case 1:choice=getchar();printf(经典模式n请选择游戏难度n);printf(1、十以内加减n2、十以内乘除n3、一百以内加减n4、一百以内乘除n5、十以内连加连减n6、十以内连乘。

10、连除n7、十以内混合运算n8、一百以内混合运算n);choice=getchar();if(choice56) /*任意键退出*/printf(A、回到主菜单nB、退出游戏nC、继续n);op=getchar();op=getchar();if(op=b|op=B)return 0;else if(op=a|op=A)flag6=1;break;else if(op=c|op=C)op=c;flag3=0;elseop=c;printf(请重新选择n);flag3=0;if(flag3!=0)printf(请输入答题数n);scanf(%d,&n);esc=getchar();second1=。

11、time(0);for(i1=1;i156)&choice!=n)printf(A、回到主菜单nB、退出游戏nC、继续n);op=getchar();op=getchar();if(op=b|op=B)return 0;else if(op=a|op=A)flag6=1;break;else if(op=c|op=C)op=c;flag3=0;elseop=c;printf(请重新选择n);flag3=0;printf(第一关n);for(i2=1;i256)&choice!=n)printf(A、回到主菜单nB、退出游戏nC、继续n);op=getchar();op=getchar();if。

12、(op=b|op=B)return 0;else if(op=a|op=A)flag6=1;break;else if(op=c|op=C)op=c;flag3=0;elseop=c;printf(请重新选择n);flag3=0;while(nwrong3&nright6&nright10&nright14)hunhe();break;case 4:srand(time(0);choice=getchar();printf(时间模式n你有60秒左右的时间来进行游戏n按回车开始游戏n);choice=getchar();if(choice56)&choice!=n)printf(A、回到主菜单n。

13、B、退出游戏nC、继续n);op=getchar();op=getchar();if(op=b|op=B)return 0;else if(op=a|op=A)flag6=1;break;else if(op=c|op=C)op=c;flag3=0;elseop=c;printf(请重新选择n);flag3=0;second1=time(0);doflag5=rand()%1+0;hunhe();second3+=(etime2-etime1);while(second360);break;flag3+;second2=time(0);while(op=c);if(flag6=0)printf(共答对%dn,nright);printf(用时%dn,second2-second1);score(second2-second1,etime);award();nright=0;nwrong=0;printf(按回车继续n); /*控制循环继续*/op=getchar();printf(你想继续吗? Y|Nn);op=getchar();if(op=y|op=Y)op=a;if(op=n|op=N)return 0;mode=getchar();flag6=0;while(op=a|op=A);return 0。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值