Question:

So basically using the class below I want to create polynomials as can be seen in the example:

Command: s

Set coefficient. Give A n c: x 3 33.33

Command: o

Output poly. Give A: x

Polynomial x: 0x^0 + 0x^1 + 0x^2 + 33.33x^3

Command: s

Set coefficient. Give A n c: x 2 2.222

Command: o

Output poly. Give A: x

Polynomial x: 0x^0 + 0x^1 + 2.222x^2 + 33.33x^3

Class:

```
#include <vector>
class poly
{
private:
std::vector<double> coefficientVector;
// Constructed implicitly to initially be null.
int SIZE() const; // Shorter way to write size() of a poly
private:
bool wellFormed () const; // Null or last coefficient is non-zero
void trimZeros (); // Remove high-end zero coefficients.
public:
void nullify (); // Create 'null' poly with no coefficients
poly (); // Not needed when based on 'vectors'
bool isNull () const;
int degree() const;
public:
void setCoefficient (const int exponent, const double coefficient);
double getCoefficient (int exponent) const;
void output() const;
poly& operator =(const poly& rtSide);
poly operator +(const poly& rtSide) const;
poly operator -(const poly& rtSide) const;
poly operator *(const poly& rtSide) const;
double evaluate (double x) const; // Evaluate the poly at point x
// Boolean and, or, not. False = null, True otherwise
poly operator &(const poly& rtSide) const;
poly operator |(const poly& rtSide) const;
poly operator ~() const;
}; // End of poly class
```

```
int main(){
cout << "Give A n c: ";
int exponent;
double coefficient;
char name;
cin >> name >> exponent >> coefficient ;
poly* name1 = new poly[26][26];
int count = 0;
name1[0][0] = name;
name1[0][1] = count;
if (name1[0][1] == NULL){
name1[2 + (exponent/1) ][0] = exponent;
name2[2 + (exponent/1)][1] = coefficient;
cout << name1[i];
return 0;}
```

The problem is I am not sure how to implement the setcoefficient function, this was just a trial.