6.9.                                             177

prepend(temp);          //  
for (int i = 1; i < size; ++i) {

assert(expon[i - 1] < expon[i]);

temp = new term(expon[i], coef[i]);

assert(temp != 0);

prepend(temp);      // 
}
degree = h -> exponent;

}

polynomial::polynomial(const polynomial& p) : degree(p.degree)
{

term* elem = p.h, *temp;

h = 0;

while (elem) {          // 

temp = new term(elem -> exponent, elem -> coefficient) ;

assert(temp != 0);

prepend(temp) ;

elem = elem -> next;

}
reverse() ;

}

       

 .

void polynomial::add_term(term*Sc a, term*& b)
{

term* c;

if (a -> exponent > b -> exponent) {      // 
 = new term(a -> exponent, a -> coefficient) ;

assert(c != 0) ;

a = a. -> next ;

prepend(c) ;

}

else if (a -> exponent < b -> exponent){ // b
c = new term(b -> exponent, b -> coefficient) ;

assert(c != 0) ;

b = b -> next;

prepend(c) ;

}
else {       //  

if (a -> coefficient + b -> coefficient i= 0) {
c = new term( a -> exponent,

a -> coefficient + b -> coefficient);

assert(c != 0) ;

prepend(c) ;

}