-
December 5th, 2009, 09:18 PM
#1
Need help with assignment, i cant fig it out.
I try to do this assignment, with the calculator at start, then we suppose to type in an arithmetic expression, the screen should keep display the expression, only when hitting " = " then the screen change to the result. Suppose to use stack, but i cant really fig it out how... Can anyone plz enlighten me, i really appreciate it.
Objective:
You are to modify the program for assignment 1 by allowing the user to enter the whole arithmetic expression and hit "=" key to get the result.
-
December 6th, 2009, 10:20 PM
#2
Re: Need help with assignment, i cant fig it out.
If it's what I think it is, you'll need to study about converting infix expressions to postfix (or prefix) and then using the stack to evaluate the postfix (or prefix) expression.
Example:
1 + 2 (infix)
1 2 + (postfix)
3 (evaluated using stack)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|