#include<stdio.h>
#include<math.h>
#include<windows.h>
int right=;
int wrong=;
void add()
{
int a,b,c,d;
a=rand()%;
b=rand()%;
printf("请回答:\n\t\t %d + %d = ",a,b);
scanf("%d",&c);
if(a+b==c)
{
printf("回答正确!\n");
right++;
}
else
{
printf("回答错误!\n");
wrong++;
}
}
void minu()
{
int a,b,c;
a=rand()%;
b=rand()%;
printf("请回答:\n\t\t %d - %d = ",a,b);
scanf("%d",&c);
if(a-b==c)
{
printf("回答正确!\n");
right++;
}
else
{
printf("回答错误!\n");
wrong++;
}
}
void mul()
{
int a,b,c;
a=rand()%;
b=rand()%;
printf("请回答:\n\t\t %d * %d = ",a,b);
scanf("%d",&c);
if(a*b==c)
{
printf("回答正确!\n");
right++;
}
else
{
printf("回答错误!\n");
wrong++;
}
}
void di()
{
int a,b,c;
a=rand()%;
b=rand()%;
printf("请回答:\n\t\t %d / %d = ",a,b);
scanf("%d",&c);
if(a/b==c)
{
printf("回答正确!\n");
right++;
}
else
{
printf("回答错误!\n");
wrong++;
}
}
void main()
{
int choise;
int con=;
printf("\n\t\t\t欢迎进入小学简易四则运算\n\n");
while()
{
printf("请选择:\n");
printf("\t\t\t 加法运算(请输入1)\n");
printf("\t\t\t 减法运算(请输入2)\n");
printf("\t\t\t 乘法运算(请输入3)\n");
printf("\t\t\t 除法运算(请输入4)\n");
printf("\t\t\t 退出运算(请输入5)\n");
if(con==)
scanf("%d",&choise);
switch(choise)
{
case :
add();
break;
case :
minu();
break;
case :
mul();
break;
case :
di();
break;
case :
return;
}
printf("\n\t\t\t继续运算?(请输入1)\n");
printf("\n\t\t\t重新选择?(请输入2)\n");
printf("\n\t\t\t退出运算?(请输入3)\n");
scanf("%d",&con);
if(con==)
con=;
else if(con==)
con=;
else if(con==)
break;
else
printf("抱歉!,你输入的指令有误!请重新输入!\n");
}
printf("您总共完成了 %d 道题\n正确 %d 道\n错误 %d 道\n",right+wrong,right,wrong);
}

最新文章

  1. 记录一次bug解决过程:mybatis中$和#的使用
  2. javascript实现原生ajax的方法
  3. ASP.NET生成WORD文档,服务器部署注意事项
  4. HTTP Error 503. The service is unavailable
  5. 扩展XAF模型信息实现自定义功能
  6. loj 1221(spfa判正环)
  7. Acdream Chinese Girls&#39; Amusement
  8. javascript AOP实现
  9. quickeys 过期解决办法
  10. uva 11275 3D Triangles
  11. Hello Indigo
  12. NET Core站点部署到Linux服务器
  13. JVM学习笔记二:垃圾收集算法
  14. 使用SuperSocket打造逾10万长连接的Socket服务
  15. SpringBoot如何新建一个项目 2017.12.14
  16. 使用 Linux 文件恢复工具
  17. tensorflow安装过程cpu版-(windows10环境下)---亲试可行方案
  18. Chapter 4 Invitations——6
  19. remmina如何上传文件到linux服务器
  20. PHP 操作 Redis 的手册

热门文章

  1. CMake使用总结【转】
  2. execute ps1 with pwsh.exe
  3. YTU 2920: Shape系列-7
  4. linux下开机启动svn配置
  5. AutoIT: FileReadLine可以对文件进行读行操作
  6. Python3字符串方法
  7. UI:归档、反归档、数据持久化
  8. Linux 软链接 硬链接 ln命令(简约说明版)
  9. 项目迁移腾讯云后,用户反馈,https证书不匹配。
  10. 微信小程序中如何使用setData --- 修改数组对象、修改对象