Recongising math Expression

Hi, mates!
I want to create a binary tree, from given arithmetic expression (including numbers, operator : '+', '-', '+', '/' and brackets) and then evaluete it.
I wrote the TreeNode class and evaluating functions. But my problem is how to recongnise the parts of the expreesiong given... I already wrote a function that checks if the brackets are put correctly... but i couldn't go any further.
Any ideas will be appreciated.
Thank you in advance !
Last edited on
http://www.cplusplus.com/forum/articles/1295/

You can also google for math parsers and find some open source ones that you can use the code from to help you :)
I agree with you, Zaita. But i wasnt trying to spam the forum. When i search the web for such kind of problem i find everything about evaluating math expression in a tree, but ideas for parsing string(the expression) to a binary tree:(
Sorry if i asked a trivial question.
Consider the Interpreter pattern. It is not easy to implement but it might suit your needs for simple expressions.
Topic archived. No new replies allowed.