hegongda307 @ 2019-11-24 14:46:07
#include<string.h>
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
using namespace std;
int top,S[1005];
void push(int x)
{
S[++top]=x;
}
int pop()
{
top--;
return S[top+1];
}
void calculator()
{
top=0;
int a,b;
char s;
cin>>s;
while(s!='@')
{
if(s=='+')
{
a=pop();
b=pop();
push(a+b);
}
else if(s=='-')
{
a=pop();
b=pop();
push(b-a);
}
else if(s=='*')
{
a=pop();
b=pop();
push(a*b);
}
else if(s>='0'&&s<='9')
{
push(s-'0');
}
cin>>s;
}
printf("%d\n",pop());
}
int main()
{
calculator();
return 0;
}
by zr太弱了 @ 2019-11-24 14:55:45
字符串是个好东西
by Orange0628 @ 2023-09-03 16:26:34
实在不行,题解等你,请!
题解入口