Humans solve problems using patterns blah blah. Computers are better suited to solving problems using itterative or something methods. There are dozens of methods available. At its simplist you try every value of x from minus infinity to positive infinity, until you find a value that "works" (makes both sides of the equation equal). Of course it's not possible to simply use "every" value.
Instead you can try going through values of x from -9999 to 9999. It's up to you which degree of decimal point accuracy to use. Most equations you solve have fairly small values of x, but allow the option for th user to pick a range (or make your program automatically increase the range if no solutions found). Although this might seem to be the long way round, remember computers can calculate simple things like this VERY fast.
You'll need to decide on a cut off point level of accuracy, for example within 6 decimal places. I've not attempted a program like this before (but I'll try one) so I'm not sure of the optimal values. Basically you will need to give your program the ability to decide if a value is close enough in terms of decimal points to be the correct answer, or if the range should be broadened. (If after the range has been increase and no better match has been found, then the initial value we weren't sure about will be assumed to be the answer).
This might seem a rather sloppy method but should solve simple alegbraic equations satisfactorally, and suprisingly quickly. Consider these points:
* Polynomials can have more than one solution.
* By developing the logic of your program futher you can define a range better. Eg your program can do a few logical checks to determine whether x must be negative or positive, and thus half the number to be checked.
* Use of pointers and references passed as function parameters, as opposed to global variables, can speed up the program.
There are various other improvements you can make to this kind of program, but that should keep you busy
Alternatively you could try to create a program that emulates human thinking and attempts to solve the algebra symbolically. That is following a list of guidelines to move the terms around the equation. Even though it is the simplist to understand, it will be harder to program and I would attempt the above method first.
Well good luck.