The desired accuracy is upto 6 decimal places. The formula for finding a real root of an equation f(x) = 0 is given by
Xn+1= Xn- f(xn)/f '(xn) n = 0, 1, 2...
X0 denotes the initial approximate value of the root. This value is modified at each iteration. The absolute value of the difference between the new and the old value of the root is computed at the end of each iteration. When the difference reaches an acceptable level of accuracy, control goes out of the loop.
cout<<"Enter the initial value of root \n";
error = fabs (xl-x0);
cout<<"The real root is "<<x0;