Polynomial Program: - Poly - SEEN
Polynomial Program: - Poly - SEEN
#ifndef __Poly_SEEN
#define __Poly_SEEN
#include <iostream>
using namespace std;
class Poly
{
public:
Poly() { pol = NULL; } // default constructor
Poly(const int* p, int terms); // constructor
Poly operator+(const Poly& q) const; // poly addition
Poly operator-(const Poly& q) const; // poly subtraction
Poly operator*(const Poly& q) const; // poly multiplication
Poly derivative();
bool increasing(double xVal);
double defIntegralAt(double, double);
double eval(double);
friend ostream & operator << (ostream & out, const Poly & p);
private:
int length() const; // length of pol
int* pol;
};
#endif
Polynomial Program
NOTE that the display method should produce the exact output sgow, so you will need to modify it.
(2x^8 + 1x^7 + 9)
Poly derivative();
double eval();
friend ostream & operator << (ostream & out, const Poly & p);
The display method will be modified to output as shown above. The operator << listed
above should print the same output as the display method, so it will be easy after you
correct the display method to output a polynomial like this: (2x^8 + 1x^7 + 9)
Your program will read a few polynomials from a file, and I will supply new client
program to test your code in a few days. The operator – will be similar to the operator +
so use that method as a model for your operator –
Polynomial Program
The rest of the code for Poly in the class notes can be used in your project directly. I
will discuss the logic for all the new methods in class.
I will supply a new client program which reads a polynomials from a text file. I will
also supply the text file. You need to write al the new overloaded methods so that my
client program will run correctly.
Polynomial Program