469,607 Members | 1,982 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

c++ code to convert from infix to post fix

program that uses a stack to convert a given infix expression to a
postfix expression and then to evaluate it.
program should first check if the infix expression entered has
balanced brackets ( (, [, {, ), ], } ) and if not should produce an
error. The program should handle at least the following operators (+,
-, *, /, %). Assume the operands are single digit integers.
thank you

Oct 21 '07 #1
2 6509
On 2007-10-21 15:57, os*************@yahoo.com wrote:
program that uses a stack to convert a given infix expression to a
postfix expression and then to evaluate it.
That is not a correct sentence it is just the end of a sentence, so I
have come up with the following suitable beginning: "Think of a".
program should first check if the infix expression entered has
balanced brackets ( (, [, {, ), ], } ) and if not should produce an
error.
Again, you forgot the beginning of the sentence: "The".
The program should handle at least the following operators (+,
-, *, /, %). Assume the operands are single digit integers.
OK, I am thinking about it.
thank you
No problem, you might also be interested in section 5.2 of the FAQ:
http://www.coders2020.com/cplusplus-...t.html#faq-5.2

--
Erik Wikström
Oct 21 '07 #2
<os*************@yahoo.comwrote:
program that uses a stack to convert a given infix expression to a
postfix expression and then to evaluate it.
program should first check if the infix expression entered has
balanced brackets ( (, [, {, ), ], } ) and if not should produce an
error. The program should handle at least the following operators (+,
-, *, /, %). Assume the operands are single digit integers.

That is a bad assignment and teaches you, by implication, the wrong way to
approach things, it is child like to check for balanced brackets ahead of
time. Be very skeptical of this instructor.
Oct 21 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

19 posts views Thread by caramel | last post: by
reply views Thread by stesia | last post: by
1 post views Thread by Taras_96 | 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.