I have an assignment to work on and it's a bit confusing.
Here's the problem:
Using dynamic arrays, implement a polynomial calss with polynomial additions, subtraction, and multiplication.
Discussion: A variable in a polynomial does nothing but act as a placeholder for the coefficients. Hence, the only interesting thing about polynomials is the array of coefficients and the corresponding exponent. Think about the polynomial
x*x*x + x + 1
Where is the term in x*x? One simple way to implement the polynomial class is to use an array of doubles to store the coeficients. The index of the array is the exponent of the corresponding term. If a term is missing, then it simply has a zero coefficient. There are techniques for representing polynomials of high degree with many missing terms. These use so-called sparse matrix techniques. Unless you already know these techniques, or learn very quickly, don't use these techniques.
Provide a default constructor, a copy constructor, and a parameterized constructor that enables an arbitrary polynomial to be constrcuted.
Supply an overloaded operator = and a desctructor.
Provide these operations:
polynomial + polynomial, constant + polynomial, polynomial + constant,
polynomial - polynomial, constant - polynomial, polynomial - constant,
polynomial * polynomial, constant * polynomial, polynomial * constant
Supply functions to assign and extract coefficients, indexed by exponent.
Supply a function to evaluate the polynomial at a value of type double.
You should decide whether to implement these functions as members, friends, or standalone functions.
I don't want anyone to do the problem for me or anything; I put the quote here simply for reference.
I am, however, quite confused on where to start. I'm not sure what the problem is even asking me to do really. Could someone show me an example of what the program should output and maybe a little sudocode as well? It would help tremendously.