new here

Discussion in 'Meet and Greet' started by faridah, Mar 30, 2011.

  1. faridah

    faridah New Member

    Joined:
    Mar 30, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    well im new here...haha
    i need to make a project in C++
    using queue
    well im kinda new 2 all these programming stuff
    anybody can help me...
    here is, the question

    QUESTION:
    One way to evaluate a prefix expression is to use queue. To evaluate the expression, scan it repeatedly until you know the final expression value. In each scan read the token are store them in queue. In each scan, replace an operator followed by two operands by two expression is a prefix expression that is calculated to 159:
    - + * 9 + 2 8 * + 4 8 6 3
    We can scan the expression and store it in queue. During the scan, when an operator is followed by two operands, such as + 2 8, we put the result, 10, in the queue.
    After the first scan, we have
    - + * 9 + 10 * + 12 6 3
    After the second scan, we have

    - + 90 72 3
    After the third scan, we have

    - 162 3
    After the fourth scan, we have

    159
     
  2. Akbar Ali

    Akbar Ali New Member

    Joined:
    Apr 3, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Student
    Location:
    Sikar
    This is right
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice