#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);
}

四则运算 来自 http://www.cnblogs.com/ys1101/p/4368103.html的更多相关文章

  1. liunx-centos-基础命令详解(1) -主要内容来自 —https://www.cnblogs.com/caozy/p/9261224.html

    关机:halt/poweroff :立刻关机reboot :立刻重启 shutdown -r now :立刻重启shutdown -h 00:00 :定时重启 now:立刻shutdown -h +n ...

  2. 随笔二-https://www.cnblogs.com/shang1680/p/9657994.html

    作业要求来自https://edu.cnblogs.com/campus/gzcc/GZCC-16SE2/homework/2097 GitHub远程仓库的地址:https://github.com/ ...

  3. 源自http://www.cnblogs.com/sciencefans/p/4394861.html

    人脸识别的四大块:Face detection, alignment, verification and identification(recognization),本别代表从一张图中识别出人脸位置, ...

  4. 按需加载.js .css文件

    首先,理解按需加载当你需要用到某个js里面的函数什么鬼,或者某个css里的样式的时候你才开始加载这个文件. 然后是怎样实现的,简单来说就是在js中动态的createElem<script> ...

  5. github入门到上传本地项目【网上资源整合】

    [在原文章的基础上,修改了描述的不够详细的地方,对内容进行了扩充,整合了网上的一些资料] [内容主要来自http://www.cnblogs.com/specter45/p/github.html#g ...

  6. 支付宝web支付

    过程 1. 用户下单 2. 商户后台产生订单 3. 请求支付宝web支付页面(将订单信息返回给用户---放在form里面---隐藏起来-----并通过脚本自动提交此form到支付宝web支付页) 4. ...

  7. ★Kali信息收集~ 1.Google Hacking + Github Hacking

    一.google hacking site site:cnblogs.com 毒逆天 intitle intitle:login allintitle allintitle:index of alli ...

  8. WebComponent魔法堂:深究Custom Element 之 面向痛点编程

    前言  最近加入到新项目组负责前端技术预研和选型,一直偏向于以Polymer为代表的WebComponent技术线,于是查阅各类资料想说服老大向这方面靠,最后得到的结果是:"资料99%是英语 ...

  9. Storm中遇到的日志多次重写问题(一)

    业务描述: 统计从kafka spout中读取的数据条数,以及写入redis的数据的条数,写入hdfs的数据条数,写入kafaka的数据条数.并且每过5秒将数据按照json文件的形式写入日志.其中保存 ...

随机推荐

  1. Interpret bytes as packed binary data

    7.1. struct — Interpret bytes as packed binary data — Python 3.6.5 documentation https://docs.python ...

  2. 1分钟看完 jQuery UI

    jQuery UI简介 jQuery UI包含了许多维持状态的小部件(Widget),因此,它与典型的 jQuery 插件使用模式略有不同.所有的 jQuery UI 小部件(Widget)使用相同的 ...

  3. VisualSVN Server的配置和使用

    VisualSVN Server的配置与使用 本版本为VisualSVN Server 2.7.3版本-不同的版本可能在设置有不同的差异,但都大同小异 1.1启动界面 安装好 VisualSVN Se ...

  4. YTU 1002: Home Work

    1002: Home Work 时间限制: 1000 Sec  内存限制: 64 MB 提交: 288  解决: 41 题目描述 临近开学了,大家都忙着收拾行李准备返校,但I_Love_C却不为此担心 ...

  5. python-----flask项目端口设置无效

    最近在做flask项目时发现了一个问题,在项目里写: app.run(host='0.0.0.0',port=9000) 但启动时,还是使用5000端口启动的. 后来经过测试,解决方法有两个: 如果启 ...

  6. 使用webBrowse把网页word等转换成图片

    http://blog.csdn.net/zgke/article/details/3248497 使用 Bitmap MyImage = Test.GetControlScrollImage(new ...

  7. python中coding:utf-8和setdefaultencoding区别

    这两个作用不一样, 1. # coding:utf-8 作用是定义源代码的编码. 如果没有定义, 此源码中是不可以包含中文字符串的.PEP 0263 -- Defining Python Source ...

  8. char-rnn-tensorflow源码解析及结构流程分析

    char-rnn-tensorflow由飞飞弟子karpathy编写,展示了如何用tensorflow来搭建一个基本的RNN(LSTM)网络,并进行基于char的seq2seq进行训练. 数据读取部分 ...

  9. ChartCtrl源码剖析之——CChartLegend类

    CChartLegend类用来绘制每一个波形的描述信息,它处于该控件的区域,如下图所示: CChartLegend类的头文件. #if !defined(AFX_CHARTLEGEND_H__CD72 ...

  10. PCB CAM自动化后台配置说明

    CAM自动化项目经历9个月时间里,在我们IT团队与工程部深入合作下,依据PCB各种场景定制特定功能,且这几个月里在不断的改进与迭代脚本功能,在此期间攻破了一个又一个难题,最终项目第一阶段已顺立上线运行 ...