469,611 Members | 1,799 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,611 developers. It's quick & easy.

Infix to postfix when have no brackets in the input?


Hi,
My infix expression never have brackets,
So how do i convert it to postfix?
For example 112*20 will yield 11220*
Which cannot be correctly evaluate(which is it 1*1220 or 11*220...?)

Is putting brackets when pushing operands on the stack is a good idea?

112*20 will yield (112)(20)* as a postfix string.

Thanks in advance.

Dec 28 '06 #1
1 1882
to*****@gmail.com wrote:
Hi,
My infix expression never have brackets,
So how do i convert it to postfix?
For example 112*20 will yield 11220*
Which cannot be correctly evaluate(which is it 1*1220 or 11*220...?)

Is putting brackets when pushing operands on the stack is a good idea?

112*20 will yield (112)(20)* as a postfix string.

Thanks in advance.
This is not a C++ *language* question. See this FAQ for what is
on-topic here:

http://www.parashift.com/c++-faq-lit...t.html#faq-5.9

If you feel yours is a language question (not an algorithm question
that happens to be implemented in C++!), please rephrase. Otherwise,
I'd recommend you seek help from comp.programming or similar.

Cheers! --M

Dec 28 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

22 posts views Thread by Tony Johansson | last post: by
19 posts views Thread by caramel | last post: by
2 posts views Thread by ostorat_elwafa2 | last post: by
2 posts views Thread by zeroeight | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.