Help with MultiplyPolynomials issue of c++

Hello everyone , This is my first post . Recently , I got problem from c++ exercise question of book , please step by step to help me , thanks a lot at advance ....

Question as below :

A) Allow a user to input TWO polynomials with any number of terms according to user input. Each
polynomial could be represented by a set of double values. For example:
Input: 5 0 -3.5 4 5 corresponds to polynomial: p(x) = 5 – 3.5x2
+ 4x3
+ 5x4
Input: -2.8 0 6 corresponds to polynomial: q(x) = -2.8 + 6x2
B) Implement a function multiplyPolynomials to multiply the two input polynomials together and return the
result.
C) The output of the program should look like below:
Polynomial Solver
-----------------
Number of terms for the first polynomial p: 5
Terms (from lowest order term to the highest): 5 4 -3.5 0 5
Number of terms for the second polynomial q: 3
Terms (from lowest order term to the highest): 6 0 -2.8
Result: 30, 24 x1, -35 x2, -11.2 x3, 39.8 x4, -14 x6
Number of terms for the first polynomial p: 3
Terms (from lowest order term to the highest): 1 2.5 3
Number of terms for the second polynomial q: 4
Terms (from lowest order term to the highest): 2 0 1.8 6.4
Result: 2, 5 x1, 7.8 x2, 10.9 x3, 21.4 x4, 19.2 x5
Number of terms for the first polynomial: -1
Thanks for using our program!

Assuming the function prototype is as follows:
double* multiplyPolynomials ( const double* const p,
const double* const q,
int np, int nq);
Last edited on
Topic archived. No new replies allowed.