```
#include <cstdlib>
#include <iostream>
//Given that f(x)= exp(x)-sin(2x). Use a Newton object to find the minimum of the
//function
using namespace std;
class Newton{
protected:
double precision;
public:
Newton(double p):precision(p){};
virtual ~Newton(){};
double Find(Function& f, double start){};//Find does the actual
//iteration for a particular function f starting from a value start f is declared as
//(a reference to) an object of the abstract Function class:
};
class Function{
public:
Function(){}
return f;
}
virtual ~Function(){};
virtual double operator()(double x)=0;//operator() does the function evaluation
//for a particular value x and dfdx evaluates its derivative
virtual double dfdx(double x)=0;
};
virtual double operator()(double x){
return exp(x)-sin(2*x);
}
virtual double dfdx(double x){
return (exp(x)-cos(2*x)*2.0;
}
int main()
{
system("PAUSE");
return EXIT_SUCCESS;
}
```

jonsca 1,059