1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solve mathematical Expression using stacks

Discussion in 'C' started by nabilbek, Dec 16, 2009.

  1. nabilbek

    nabilbek New Member

    Joined:
    Dec 16, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    C++ program (using stacks) that reads from the user a mathematical expression like:
    (3+(4-9) * (3/4) * (3+2))

    1. The program should check if the expression is correct
    1.1 An expression is correct if:
    the parantheses are correctly added and are balanced
    examples of not correct expressions can be:
    )9+8(
    (((8-1)
    etc

    Assuming that the numbers are only one digit

    2. If the expression is correct, the program should evaluate the expression and display the result.
     

Share This Page