I've been writing a calculator that shows all the steps in working out a sum. I've currently done showing the working out for "+", "-", "*" and "/". To do that I needed to get a parser to parse an equation (Ie. if I got 5+3+5+6*5+3*5/3" It would work through the sum giving me numbers I could deal with for showing the working out). Having done that, I want to add the ability to solve equations like "5X-2X^2+5-3=7X". In order to do that, I need an idea as to how to make such a parser (Even source code...). I tried one idea - I took out "X" with its Index and its exponent on the side containing "X" and sent the sum whch didn't contain "X" into the parser to return me a number and then "-"ssed "X" from it (Or "+"ssed, depending on the sum) and it returned me the answer. The problem with this was that I only managed to work out code to take out ONE "X" with its exponents.
If you have code, an idea or anything, pls reply.
0 · ·