/* Homework: Compute the value and derivative of a polynomial of degree upto two. a[0] a[1] a[2] are the coefficients for a degree two polynomial. value would mean just take in a double eval_value and */ #include #include using namespace std ; class Poly { double * coeff; double eval_point ; int n; //private member variables only to be accessed by the 'public' members of the class. public: Poly(int _n) //constructor { n =_n ; } ~Poly() //destructor { } void Print() { cout << "This is a polynomial which is of degree = " << n << endl ; } double zero_derivative() { double return_value=0. ; cout << "we evaluate at the value " << endl; return return_value ; } double first_derivative() { double return_value=0 ; cout << "we evaluate the derivative at the value" << endl; return return_value ; } }; //class declaration end. // usage of the class int main() { int n = 0; //initializer for the integer cout << "Enter the degree n of the polynomial please enter n atleast 3: "; cin >> n ; cout << "You entered: "<< n << endl; Poly p(n); p.Print(); cout << p.zero_derivative()<< endl; cout << p.first_derivative() <