开发者

How can I write this statement from infix to postfix?

How can I write thi开发者_如何学Cs statement:

9-3/(1+2)

... from infix to postfix?


9-3/(1+2)

First would be (1+2) since it has the highest order of operation.

-> 1 2 +

Then 3 divided by the result...

-> 3 1 2 + /

Then 9 minus the result....

-> 9 3 1 2 + / -


9 3 1 2 + / - (and more stuff to make 15 characters)


You can use the Shunting-yard algorithm to convert from infix to postfix notation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜