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<cmath>
#include<vector>
#include<string>
#include<cstdio>
typedef unsigned long long ull;
#define rep(i,a) for(int i=0;i<a;i++)
#define loop(i,a,b) for(int i=a;i<b;i++)
using namespace std;
const double eps = 0.00001;
const double pi = acos(-1);
const double inf = (int)1e5;

int main(void){
  double N;
  while(cin>>N,N!=-1){
    double q =1.0*N/2;
    int i = 0;
    while(abs(pow(q,3)-N)>eps*N&&i<10000){
      i++;
      //printf("%.10f\n",q);
      q=q-(pow(q,3)-N)/(3*pow(q,2));
    }
    printf("%.6f\n",q);
  }
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main(){
  double q;
  while(cin >>q,q!=-1){
    double ans = q/2;
    for(;;){
      ans = ans-((ans*ans*ans)-q)/(3*ans*ans);
      if(ans*ans*ans-q<q*0.00001 && -q*0.00001<ans*ans*ans-q) break;
    }
    printf("%.6lf\n",ans);
  }
  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 );
	int q;
	while (scanf ("%d", &q ) ){
		if (q == -1 ) break;
		double x = (double)q/2.;
		do{
			x = x - (x*x*x - q)/(3.*x*x);
		}while (fabs (x*x*x - (double)q) >= 0.00001*(double)q );
		printf ("%.9lf\n", x );

	} // end loop
		
	return 0;
}

C++: #include<iostream>
#include<string.h>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> P;

string str;

int main()
{
  int q;

  while(1){
    cin>>q;
    if(q<0)break;
    double a,b;
    b=q/2.0;
    while(2){
      a=b-(b*b*b-q)/(3*b*b);
      if(abs(a*a*a-q)<0.00001*q)break;
      b=a;
    }
    cout<<a<<endl;
  }
}

C++: #import<cstdio>
#import<cmath>
main(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<bits//stdc++.h>
using namespace std;
int main(){
	int a;
	while(cin>>a&&a!=-1){
		double x1=a/2,x2;
		int i=1;
		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<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,b,n) for(int i=b;i<n;i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

int main(){
	ll q;
	while(cin>>q){
		if(q==-1)break;
		const double EPS=(1e-7);
		double x=q/2;
		while(true){
			x =x-(pow(x,3)-q)/(3*pow(x,3));
			if(abs(pow(x,3)-q)<EPS*q)break;
		}
		printf("%,7f\n",x);
	}

	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }




double q;

int main() {
    while (cin >> q) {
        if ( abs(q + 1.0) < 1e-5 ) break;
        
        double x = q/2;
        for (int i = 0; i < 10000000; ++i) {
            if ( abs(x*x*x - q) < 0.00001 * q ) break;
            x -= (x*x*x - q) / (3.0 * x*x);
        }
        cout << fixed << setprecision(9) << x << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>

typedef long long int ll;


using namespace std;

int q;
double x;

double f(){
	return x*x*x-q;
}
double df(){
	return 2*x*x;
}

double calc(){
	x=q/2.0;
	while(1){
		if((fabs(f())>-0.00001*q&&fabs(f())<0.00001*q)){
			break;
		}
		x=(x*df()-f())/df();
	}
	return x;
}

int main(){
	while(1){
		cin>>q;
		if(q==-1)break;
		printf("%.15lf\n", calc());
	}
}

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

int main(){
	int q;
	while(cin>>q,q!=-1){
		double x=q/2.0;
		while(fabs(x*x*x-q)>=0.00001*q)x-=(x*x*x-q)/(3*x*x);
		printf("%.6f\n", x);
	} 
	return 0;
}

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

using namespace std;

bool C(long double x, long double q) {
	return x*x*x < q;
}

int main() {
	long double q;
	while (cin >> q) {
		if (q == -1.0) {
			break;
		} else if(q == 1.0) {
			cout << 1.0 << endl;
		} else {
			long double lb = 0;
			long double ub = q/2.0;
			for (int i = 0; i < 100; i++) {
				long double mid = (lb+ub) / 2.0;
				if (C(mid, q)) lb = mid;
				else ub = mid;
			}
			printf("%.6Lf\n", ub);
		}
	}
	return 0;
}