By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,852 Members | 994 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,852 IT Pros & Developers. It's quick & easy.

c++ code to convert from infix to post fix

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
<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.