// 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. . . . .