且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在C ++中将堆栈用于中缀和后缀表达式

更新时间:2023-02-18 10:50:12

else if (input == '*'||'/'||'+'||'-' && s.top() >= input)

这不会做您认为做的事。

This does not do what you think it does. You need to do

else if (input == '*'|| input == '/'|| input == '+'|| input == '-' && s.top() >= input)

这看起来也像是一个错误

And this looks like an error too

bool prec (char a, char b, char c, char d);

这是函数原型的语法。您确定可以编译吗?

That's the syntax for a function prototype. Are you sure this compiles?