#include<cstdio>
#include<cstring>
#include<string>
#include<string.h>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<queue>
#include<stack>
#define ll long long
using namespace std;
int main(){
double a,t;
char b,c[10];
while(scanf("%lf%c",&a,&b)){
if(a==0&&b=='\n'){
break;
}
double ans=0;
stack<double> abc;
abc.push(a);
while(~scanf("%s %lf",c,&a)){
if(c[0]=='+'){
abc.push(a);
}
else if(c[0]=='-'){
abc.push(-a);
}
else if(c[0]=='*'){
t=a*abc.top();
abc.pop();
abc.push(t);
}
else if(c[0]=='/'){
t=abc.top()/a;
abc.pop();
abc.push(t);
}
if(b=getchar(),b=='\n') break;
}
while(!abc.empty()){
ans+=abc.top();
abc.pop();
}
printf("%.2lf\n",ans);
}
return 0;
}
读入一个只包含 +, -, *, / 的非负整数计算表达式,计算该表达式的值。
1 + 2 4 + 2 * 5 - 7 / 11 0
3.00 13.36