文章
55
粉丝
317
获赞
160
访问
32.9k
#include<iostream>
#include<stack>
#include<string>
#include<map>
#include<cstdio>
using namespace std;
//执行简单运算
float doCal(float a, float b, char c)
{
if (c == '+') return a + b;
if (c == '-') return b - a;
if (c == '/') return b / a;
if (c == '*') return a * b;
return -1;
}
//执行结果栈的运算
void doCalWithStack(stack<float> &st, char c)
{
float t = st.top();
st.pop();
float t2 = st.top();
float t3 = doCal(t, t2, c);
st.pop();
st.push(t3);
}
int main()
{
string str;
while (getline(cin, str))
{
if (str == "0") break;
&n...
登录后发布评论
暂无评论,来抢沙发