提交时间:2023-12-30 11:32:08

运行 ID: 118452

#include<bits/stdc++.h> using namespace std; stack <double> x; stack <char> s = "+-*/()"; int main(){ double a,b; char c; cin>>a; x.push(a); while(cin>>c>>b){ if(c=='*'){ a=x.top(); x.pop(); x.push(a*b); }else if(c == '/'){ a=x.top(); x.pop(); x.push(a/b); }else if(c =='+'){ x.push(b); }else{ a=x.top(); x.pop(); x.push(a-b); } } int sum = 0; while(x.size()){ } cout<<sum<<endl; return 0; }