#include
#include "STACK.cxx"
using namespace std;
int main(int argc, char *argv[])
{
char *a=argv[1];
int N = strlen(a);
STACK
for (int i=0; i
if (a[i]== '+')
save.push(save.pop()+save.pop());
if (a[i]== '*')
save.push(save.pop()*save.pop());
if (a[i]== '-')
{
save.push(save.pop()-save.pop()); //就算这里掉换顺序也一样
}
if (a[i]=='/')
save.push(save.pop()/save.pop());
if((a[i]>='0')&&(a[i]<='9'))
save.push(0);
while ((a[i]>='0')&&(a[i]<='9'))
save.push(10*save.pop()+(a[i++]-'0'));
}
cout << save.pop() << endl;
}
~
~
~
save.push(save.pop()-save.pop()); 为什么不能这样用?