i have this question:
You will implement a polynomial class that uses a dynamic array to store the polynomial's coefficients. The Polynomial class has two private members variables: a dynamic array to store the coefficients and the degree of the polynomial like so:
(private: double *coef; // Pointer to the dynamic array
int degree; // the polynomial degree)
1.Write the constructors permitting the initialization of simple polynomials of the following way:
i. Polynomial p1(3,1); // polynomial of degree 1 p1 = 3 x+1
ii. Polynomial p2(1,4,2); // polynomial of degree 2 p2 = x2+4x+2
iii. Polynomial p3(1,3,3,1); // polynomial of degree 3 p3 = x3+ 3x2 + 3x +1
that is the question.
these constructors are being handed the coefficients but the number of coefficients is chosen by the user, how do i make such constructor(s)?? and i cant put a limit on the degree of the polynomial the user wants to enter(if this were the case, i could put default values that are zero so that if he doesnt give all coefficinets, the rest of coefficients will be zero)
is the dynamic array member going to help in this problem?