给大神,请问我这程序哪里错了,编译时说这句cout<<op.pop()<<endl;错,no operator defined which takes a right-hand operand of type 'void' (or there is no acceptable conversion)
执行 cl.exe 时出错.改怎么改
逆波兰式1.obj - 1 error(s), 0 warning(s)
#include<stdio.h>
#include<string.h>#include<iostream>
#include<sstream>
#include<stack>
using namespace std;
void main()
{stack<char>op;
string s;
cout<<"请输入算术表达式"<<endl;
getline(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;
in>>n;
cout<<n<<" ";
}
}
while(!op.empty())
cout<<op.pop()<<endl;
}