1237 简单计算器
来源:互联网 发布:普通增值税发票软件 编辑:程序博客网 时间:2024/06/06 05:42
#include<iostream>#include<cstdio>#include<cstring>#include<stack>#include <algorithm>using namespace std;int main(){double n,m;char c;while(scanf("%lf",&n)){ c=getchar();if(c=='\n'||n==0)break;stack<double> s;s.push(n); scanf("%c",&c);while(scanf("%lf",&n)){ if(c=='*') { m=s.top(); m*=n; s.pop(); s.push(m); } if(c=='/') { m=s.top(); m/=n; s.pop(); s.push(m); } if(c=='+') s.push(n); if(c=='-') s.push(0-n); if(getchar()=='\n')break;c=getchar();}double sum=0;while(!s.empty()){sum+=s.top();s.pop(); }printf("%0.2lf\n",sum);}return 0;}
0 0
- HDU 1237 简单计算器
- HDU 1237 简单计算器
- 1237 简单计算器
- hdu 1237 简单计算器
- HDU 1237 简单计算器
- hdu 1237 简单计算器
- hdu 1237 简单计算器
- hdu - 1237 - 简单计算器
- hdu 1237 简单计算器
- HDU-简单计算器-1237
- hdu 1237简单计算器
- hdu 1237 简单计算器
- hdu 1237 简单计算器
- HDU 1237 简单计算器
- HDU 1237简单计算器
- hdu 1237 简单计算器
- HDU 1237 简单计算器
- HDU-1237-简单计算器
- MySQL批量更新不同表中的数据
- Xamarin Getting Started翻译系列七--创建服务
- Shell入门
- c++中的运算符重载
- jsp_笔记
- 1237 简单计算器
- hdu 3336 Count the string(KMP+dp)
- Android LCD(三):Samsung LCD接口篇
- 解决resource directory '/xxx//res' does not exist的方法
- POJ Find them, Catch them
- 网络的可靠性
- C语言实现 球体下落路程及反弹高度求解
- [Leetcode 13, Easy] Roman To Integer
- DigestUtils