#include<iostream>
using namespace std;
double notation(){
char str[10];
cin>>str;
switch(str[0]){
case'+':
return notation() + notation();
case'-':
return notation() - notation();
case'*':
return notation() * notation();
case'/':
return notation() / notation();
default:
return atof(str);
}
}
int main(){
cout<<notation()<<endl;
//system("pause");
return 0;
}
逆波兰表达式
最新推荐文章于 2021-09-04 02:26:18 发布