请教!
我想实现一个将中缀表达式转化为后缀表达式的程序,请问这是错在哪了??#include "stdafx.h"
#include<stack>
#include<iostream>
#include<string>
using namespace std;
int main()
{
stack<char> op;
string s;
cout<<"请输入表达式: ";
cin>>s;
istringstream in(s);
char c;
while(in>>c)
{
if(c=='+'||c=='-'||c=='*'||c=='/')
op.push(c);
else if(c==')')
{
cout<<op.top()<<" ";
op.pop();
}
else if(c>='0'&&c<='9')
{
in.putback(c);
int n;
cin>>n;
cout<<n<<" ";
}
}
while(!op.empty())
cout<<op.pop()<<endl;
return 0;
}