Infix to Postfix with function support

后端 未结 5 1006
无人及你
无人及你 2021-01-15 21:34

There are many algorithms to convert infix to postfix all over the web. But my question is how to make that to support functions? For example sin(x+y)*z.

I will appr

5条回答
  •  情深已故
    2021-01-15 22:15

    binary operators like + can be considered as +(x,y) Similarly Consider sin, cos, etc functions as unary operators. So, sin(x+y)*z can be written as x y + sin z *. You need to give these unary functions special treatment.

提交回复
热议问题