Converting String Equations into Math Formula

Pencillius

New member
Joined
Jul 29, 2006
Messages
4
Programming Experience
Beginner
Hi, I'm not sure if this is where I should be posting this but I hope so :)

Anyways here is the problem. I've got strings in a database that hold equations like "x+y/z". Now what I need to do i get values for those variables at run time and then work out the given answer.

So far I've managed to get the varaibles to convert to the correct values, in essence I get a new string that would look like this "1+4/2". Is there any way to now process this string to get the correct answer (i.e. 3) ? I'm thinking that'll I have to parse through the string and then add each item to a new integer variable. Is there any other way of doing it that will be less time consuming?

Thanks in advance
 
Back
Top