CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2009
    Posts
    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.

  2. #2
    Join Date
    Nov 2009
    Posts
    18

    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
  •  





Click Here to Expand Forum to Full Width

Featured