Oddly enough, I answered this very question on another forum yesterday. The trick is to convert the expression to postfix so that you can easily evaluate it with a stack based approach. Alternatively, you could build an expression parse tree, but that just adds extra unnecessary steps in most cases.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
Please read the Announcement .
Though I can't specifically say that you're doing a homework problem, the signs are there. We don't do work for you. Please post some code, and we'll help you troubleshoot.
alc6379
Cookie... That's it
2,820 posts since Dec 2003
Reputation Points: 186
Solved Threads: 147