Exercise 8 from Chapter 3 of the textbook (p.143)
(to do with using an ADT for a polynomial)
P.Coefficient (P.Degree ())
P.ChangeCoefficient (P.Coefficient (3)+8, 3)
// to compute: R = P + Q
// find maximum degree
int MaxDegree = P.Degree () > Q.Degree () ? P.Degree () : Q.Degree ();
// loop through and add coefficients
for ( int i=0; i<=MaxDegree; i++ ) // loop through coefficients
{
R.ChangeCoefficient (P.Coefficient (i)+Q.Coefficient (i), i);
}