Go: package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

//Sliceconvtof ...
func Sliceconvtof() []float64 {
	strs := strings.Split(sc.Text(), " ")

	var flts []float64
	var x int

	for _, s := range strs {
		x, _ = strconv.Atoi(s)
		xf := float64(x)
		flts = append(flts, xf)
	}

	return flts
}

//ThirdRoot .
func ThirdRoot(f float64) float64 {
	xn := f / 2
	var dmt float64

	for {
		dmt = math.Pow(xn, 3) - f
		if math.Abs(dmt) < 0.00001*f {
			break
		}

		xn = xn - (dmt / (3 * math.Pow(xn, 2)))
	}

	return xn
}

func main() {

	for sc.Scan() {
		i := Sliceconvtof()
		if i[0] == -1.0 {
			break
		}
		fmt.Printf("%6f\n", ThirdRoot(i[0]))
	}

}

C++: #include <iostream>
#include <cstdio>

using namespace std;
#define rep2(x,from,to) for(int x = (from); x < (to); ++(x))
#define rep(x,to) rep2(x,0,to)
int main() {
	double q;
	while(cin >> q && q != -1) {
		double x = q/2;
		while(x*x*x-q>=0.00001*q) {
			x = x - (x*x*x-q)/(3*x*x);
		}
		printf("%.6lf\n", x);
	}
	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>

using namespace std;

typedef long long ll;

int main(){

	double q;
	while(~scanf("%lf",&q)){
		if(q==-1) break;
		double x=q/2;
		for(;;){
			x = x - (pow(x,3.0)-q)/(3*x*x);
			if(abs(pow(x,3.0)-q) < 0.00001*q) break;
		}

		printf("%.6f\n",x);
	}
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<time.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define rp(a) while(a--)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main(){
	ll n;
	while(cin>>n,n+1){
		double q=n,x=q/2.0;
		while(abs(x*x*x-q)>0.00001*q){
			x-=(x*x*x-q)/(3*x*x);
		}
		printf("%.9f\n",x);
	}
}

C++: #include <bits/stdc++.h>
#define range(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define rep(i,n) range(i,0,n)
using namespace std;

int main(void){
	int q;
	while(cin >> q){
		if(q==-1) break;
		double x=1.0*q/2.0;
		while(abs(x*x*x-q)>0.000001){
			x=x-(x*x*x-q)/(3.0*x*x);
		}
		cout.precision(6);
		cout << fixed << x << endl;
	}
	return 0;
}

C++: #include <cstdio>
#include <stack>
#include <cmath>
using namespace std;
int main()
{
	int q;
	stack<double> x;
	while (scanf("%d", &q))
	{
		if (q == -1) break;
		x.push((double)q/2);
		while (abs(x.top()*x.top()*x.top() - q) >= 0.00001*(double)q)
			x.push(x.top() - (x.top()*x.top()*x.top() - q)/(3*x.top()*x.top()));
		printf("%.6f\n", x.top());
	}
}

C++: #include<cstdio>
#include<cmath>
main(){int q;float x;for(;scanf("%d",&q),~q;printf("%f\n",x))for(x=q/2.;fabs(x*x*x-q)>1e-5*q;x-=(x*x*x-q)/(3*x*x));}

C++: #include <iostream>
#include <cmath>
#include <cstdio>

#define SQ(x) (x)*(x)
#define CU(x) (x)*(x)*(x)

using namespace std;

int main(void){
    int q;
    double x;
    double x_a;
    
    while(cin>>q,q!=-1){
        x=q/2.0;
        x_a=abs(CU(x)-q);
        while(true){
            if(x_a<0.00001*q)break;
            x=x-(CU(x)-q)/(3*SQ(x));
            x_a=abs(CU(x)-q);
        }
        printf("%.6lf\n",x);
    }
    return(0);
}

C++: #include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>
#include <set>
#include <iostream>
#include <map>
#include <functional>
#include <cstdlib>
#include <numeric>
#include <queue>
#include <complex>

using namespace std;

#define reep(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reep(i,0,n)

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> Point;

int main()
{
	int q;
	while(scanf("%d", &q), q!=-1){
		double x = q/2.0;
		while(fabs(x*x*x-q) >= 0.00001*q)
			x = x - (x*x*x-q)/(3.0*x*x);
		printf("%f\n", x);
	}

	return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

int main()
{
//	cut here before submit 
//	freopen ("testcase.third_root", "r", stdin );
	while (1 ){
		int q;
		scanf ("%d", &q );
		if (q == -1 ) break;
		double x = (double)q/2.;
		while (fabs (x*x*x - (double)q) >= 0.00001*(double)q ){
			double y = (x*x*x - (double)q)/(3.*x*x);
			x = x - y;
		} // end while
		printf ("%lf\n", x );
	} // end loop
		
	return 0;
}

C++: #include<iostream>
#include<math.h>
#include<stdio.h>

using namespace std;

long double make(long double in){
  int i = (int)in;
  int k = 0;
  while(i){
    k++;
    i/=10;
  }
  for(int i = 0; i < k; i++) in/=10;
  return 1+in;
}

int main(){

  long double in;
  while(cin >> in){
    if(in == -1) break;
    long double x = in/2;
    long double judge = make(in);
    while(1){
      if(fabs(x*x*x*10*10*10*10*10 - in*10*10*10*10*10) < judge){
	printf("%.6Lf\n",x);
	break;
      }
      x = (2*x/3 +in/(3*x*x));
    }
  }
  return 0;
}

C++: #include <stdio.h>
#include <math.h>
int main(void){


    int q;
      while(scanf("%d", &q)!= EOF) {
      double x;     
          
    x=q/2;
    
    
   
    if(q>0)  {
     double xx;
     
    while((fabs(x*x*x-q))>(0.00001*q)){
       
        xx=x-((x*x*x-q)/(3*x*x));
        
        x=xx;
    }
    printf("%.6f\n",xx);
      }
      }
      
}

C++: #include <iostream>
#include <iomanip>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>

using namespace std;

int main() {
	while (1) {
		double q;
		cin >> q;
		if (q == -1)
			break;
		double x = q / 2;
		while (fabs(pow(x, 3) - q) >= 0.00001) {
			x = x - (pow(x, 3) - q) / (3 * pow(x, 2));
		}
		cout << fixed << setprecision(6) << x << endl;
	}
	return 0;
}

C++: #include<bits//stdc++.h>
using namespace std;
int main(){
	int a;
	while(cin>>a&&a!=-1){
		double x1=a/2,x2;
		int i=1;
		if(a==1){
			cout<<"1.00000"<<endl;
		}
		else{
			while(true){  
				x2=x1-(x1*x1*x1-a)/(3*x1*x1);
				if(abs(x2*x2*x2-a)<0.00001*a) 
				{
					cout<<x2<<endl;
					break;
				}
				x1=x2-(x2*x2*x2-a)/(3*x2*x2);
				if(abs(x1*x1*x1-a)<0.00001*a) 
				{
					cout<<x1<<endl;
					break;
				}
				i++; 
			}
		}

	}
	return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;

int main() {
	int n;
	double res;
	while (cin >> n) {
		if (n == -1) break;
		res = n / 2.0;

		while (1) {
			res = res - ((res*res*res - n) / (3 * res*res*res));
			if (fabs(res*res*res - n) < 0.00001 * n) break;
		}
		cout << res << endl;
	}
	return 0;
}