I have a project which converts infix expressions to postfix like: 1+2 = 12+. I want to implement it using stack. However, I did not understand our teacher's discussion regarding stack. Can somebody suggest a site which offers clear and understandable tutorials for a newbie like me? Or can somebody tutor me about this?
Your help is highly appreciated. Please please. I'm begging.
Much Thanks!
RPN
Started by eyeshere, Oct 10 2009 01:52 AM
4 replies to this topic
#1
Posted 10 October 2009 - 01:52 AM
|
|
|
#2
Posted 10 October 2009 - 06:08 AM
You are dealing with two distinct, though related, issues. Are you having trouble with how to use stacks, or with how to convert from infix to postfix? Also, how complicated of expressions do you need to support? I have two tutorials on stacks: http://forum.codecal...ing-arrays.html and http://forum.codecal...sing-lists.html that may be helpful.
#3
Posted 12 October 2009 - 12:51 AM
I have problem with both. But, with your help, I think i'll be able to understand it in its simplest way. Thank you.
P.S. Do you have another program that doesn't use iostream.h? Because our teacher only introduced stdlib.h, stdio.h, conio.h, string.h, ctype.h and math.h to us. We also use printf rather than cout.
P.S. Do you have another program that doesn't use iostream.h? Because our teacher only introduced stdlib.h, stdio.h, conio.h, string.h, ctype.h and math.h to us. We also use printf rather than cout.
#4
Posted 12 October 2009 - 08:50 AM
You should be able to replace cin with scanf and cout with printf. Ideally, you would be using the std::stack rather than building your own, but it appears that you are learning how to build a stack, not just use it.
For how to use them, I would suggest you write each number/operator on a piece of paper and think about whether you need to display it or store it as you move from infix to postfix.
For how to use them, I would suggest you write each number/operator on a piece of paper and think about whether you need to display it or store it as you move from infix to postfix.
#5
Posted 12 October 2009 - 06:46 PM
Okay. I'll do that.


Sign In
Create Account


Back to top









