if( (mychar == '+' || mychar == '-') && (stack.peek() == '+' || stack.peek() = '-') )
我收到以下错误:
bad operand types for binary operator '||'
first type: boolean
second type: Character
我已多次检查过,但我无法弄明白。
答案 0 :(得分:1)
你忘了在结尾添加双倍==。
应该是stack.peek() == '-'
,而不是stack.peek() = '-'