Course Solutions Uncategorized (Solved) : Overload Operators Using Linked List H File Urgent Class Polynomial Private Struct Term In Q29333835 . . . .

(Solved) : Overload Operators Using Linked List H File Urgent Class Polynomial Private Struct Term In Q29333835 . . . .

 

// overload operators (-= , *= ) using linked list.

//.h file

// very urgent

class Polynomial

{

private:

       struct term

       {

            int num,

                   coeff;

            term *next;

       };

       term *head;

public:

       //constructor

       Polynomial();

       //destructor

       ~Polynomial();

Polynomial operator -=(const Polynomial &right); // overloadthis operators

Polynomial operator *= (const Polynomial &right); //overload this operators

//.cpp file

Polynomial::Polynomial()

{

       head = NULL;

}

Polynomial::~Polynomial()

{

       term* newterm = head;

       term* current = head;

       while (current != NULL)

       {

            current = current->next;

            delete newterm;

            newterm = current;

       }

       head = NULL;

}

Polynomial Polynomial::operator-=(const Polynomial & right)// overload operators using linked list.

{

       return Polynomial();

}

Polynomial Polynomial::operator*=(const Polynomial &right)

{

       return Polynomial();

}

Expert Answer


An answer will be send to you shortly. . . . .

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post