Tom Kelliher, CS18
Here's pseudocode. You need to tranlate it to the appropriate C++.
assume we're multiplying polynomials X and Y
let Z be a 0 polynomial
for i := degree of Y downto 0
if there is a coefficient of Y (call it Yco) with exponent i
for j := degree of X downto 0
if there is a coefficient of X (call it Xco) with exponent j
if there is a coefficient of Z (call it Zco) with exponent i*j
set the coefficient of Z whose exponent is i*j to
Zco+Xco*Yco
else
set the coefficient of Z whose exponent is i*j to Xco*Yco
endif
endif
endfor
endif
endfor
Z is now the product of X and Y