Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forumdisplay.php?f=20)
-   -   Solve mathematical Expression using stacks (http://www.go4expert.com/showthread.php?t=20387)

nabilbek 17Dec2009 01:46

Solve mathematical Expression using stacks
 
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.


All times are GMT +5.5. The time now is 19:45.