6-7 简单计算器
来源:互联网 发布:丑老太婆网络照片 编辑:程序博客网 时间:2024/06/07 06:26
//简单计算器#include<stdio.h>int main(int argc,char const *argv[]){int value1,value2;int sum=0;int flag=1;char ch;scanf("%d",&value1);while((ch=getchar())!='='){scanf("%d",&value2);if(ch=='+')sum=value1+value2;else if(ch=='-')sum=value1-value2;else if(ch=='*')sum=value1*value2;else if(ch=='/'){if(value2==0){flag=0;break;}elsesum=value1/value2;}else{flag=0;break;}value1=sum;}if(flag==0)printf("error\n");elseprintf("%d\n",sum);return 0;}
阅读全文
0 0
- 6-7 简单计算器
- 6-1. 简单计算器
- 6-1. 简单计算器(20)
- 6-1. 简单计算器(20)
- 6-1. 简单计算器(20)
- 6-1. 简单计算器(20)
- 简单计算器
- 简单计算器
- 简单计算器
- 简单计算器
- 简单计算器
- 简单计算器
- 简单计算器
- 简单计算器
- 简单计算器
- 简单计算器
- 简单计算器
- 简单计算器
- C++智能指针
- 51nod 1043 幸运号码 (数位dp)
- 如何写一个简单的ping程序
- json格式
- 中医医院医生微信预约系统使用教程
- 6-7 简单计算器
- 22.c语言各种输入输出与错误处理
- 数据结构之线性表(建表-插入-删除-合并)
- Importing the multiarray numpy extension module failed
- CSS 选择器权重计算规则
- Codeforces 849 B. Tell Your World(计算几何)
- C语言(在linex系统操作)通讯录
- C#笔记(2)md5加密
- 【python爬虫03】使用Scrapy框架模拟登录知乎