Newton's sqrt in c++

C++
#include<bits/stdc++.h> 
#define EPSILON 0.001 
using namespace std; 

double func(double x) { 
    return x*x*x - x*x + 2; 
} 
  
double derivFunc(double x) { 
    return 3*x*x - 2*x; 
} 
   
void sqrt(double x) { 
    double h = func(x) / derivFunc(x); 
    while (abs(h) >= EPSILON) { 
        h = func(x)/derivFunc(x);    
        x = x - h; 
    } 
    cout << "The value of the root is : " << x; 
} 
  
int main() { 
  	ios::sync_with_stdio(0);
  	cin.tie(0);
    double x0;
  	cin >> x0;
    sqrt(x0); 
    return 0; 
}
Source

Also in C++: