I plan revise my program to handle polynomial equations with one variable.

i.e.

So I am planning to create a class or function which handles, for the time being, addition, subtraction and multiplication of polynomials.Code:5x² - 3x + 7 - x ... (x + 7)*(3 - x)

Any ideas or pointers in the right direction would be useful.

At present I have had the following ideas.

To convert all terms into the form :-

Where 'a' and 'b' are just integers.Code:ax^b

So x^2 would be:-

5x would be:-Code:1x^2

And just plain ordinary numbers such as '7' would be:-Code:5x^1

Recall that x^0 = 1Code:7x^0

so 7^1 = 7.

Since each term will have three stages. It will be reasonably easy to separate the coefficients from the exponents and do the appropriate math.

For my addition/subtraction class I have this idea.

For my multiplication class I have this idea.Code:String Addition (string A, string B) { A = "3x + 7"; » 3x^1 + 7x^0 B = "4x² - 8x"; » 4x^2 - 8x^1 ... Count no. terms in string A and B Create a nested for loop, looping through the no. terms Add together coefficients if the exponents are equal return string; }

ThanksCode:String Multiplication (string A, string B) { A = "x+2"; »1x^1 + 2x^0 B = "x-3"; »1x^1 + 3x^0 ...Count no. terms in string A and B Create a nested for loop, looping through the no. terms Multiply coefficients and exponents, of course is a little more complicated than this but you get the idea. return string; }