ifndef POLY_H
#define POLY_H
class Poly {
public:
Poly() : first(0) { }
void addTerm(double coeff, unsigned exponent);
// add term (coeff^exponent) to the polynomial;
// might just change coefficient of existing term,
// or might insert new term; maintains terms
// in order from greatest to least exponent
private:
struct Term {
double coeff;
unsigned exponent;
Term *next;
Term(double c=0, unsigned e=0) // Term constructor done
: coeff(c), exponent(e), next(0) { }
};
Term *first; // pointer to first polynomial term
void printAbsTerm(Term *t) const;
};
#endif
I need some help so I can understand what I need to do. How can I go about starting to add a term with coefficient and exponent?