本题为洛谷:
本题有用到了栈:
#include<iostream>
#include<cstring>
using namespace std;
int st[100],top=0;
int main(){
char x;
int n=0;
do{
x=getchar();
if('0'<=x&&x<='9'){
n=n*10+x-'0';
}else if(x=='.'){
st[++top]=n;
n=0;
}else{
if(x=='+'){
int a=st[top--];
int b=st[top--];
st[++top]=b+a;
}
if(x=='-'){
int a=st[top--];
int b=st[top--];
st[++top]=b-a;
}
if(x=='*'){
int a=st[top--];
int b=st[top--];
st[++top]=b*a;
}
if(x=='/'){
int a=st[top--];
int b=st[top--];
st[++top]=b/a;
}
}
}while(x!='@');
while(top){
cout<<st[top--];
}
return 0;
}