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 <bits/stdc++.h>
#define SIZE 300005
#define MOD 1000000007LL
#define INF 1 << 30
#define LLINF 1LL << 60
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define FORALL(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define FOREACH(i,c) for(auto (i) : (c))
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
using namespace std;
typedef long long ll;
typedef pair<ll,ll> Pll;
typedef pair<int, int> Pii;
typedef pair<double, double> Pdd;
typedef complex<double> dcomplex;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cout<<a[i]<<((i==a.size()-1)?"\n":" ");}}
ll gcd(ll a,ll b){int c=max(a,b);int d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
ll lcm(ll a,ll b){return a==0||b==0?0:a*b/gcd(a,b);}

void solve(const double q)
{
  double a = q*0.5;
  while(fabs(a*a*a-q)>=1e-5*q) a -= (a*a*a-q)/(3*a*a);
  printf("%lf\n",a);
}

int main()
{
  double q;
  while(cin>>q,q>0) solve(q);
  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 == -1)break;
            double xx;       
            while(1){   
                xx=x-((x*x*x-q)/(3*x*x));      
                
                if(fabs(x*x*x-q)<(0.00001*q)) break;
                x = xx;
            }          
            printf("%.7f\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 );
	int q;
	while (scanf ("%d", &q ) ){
		if (q == -1 ) break;
		double x = (double)q/2.;
		do{
			x = x - (x*x*x - (double)q)/(3.*x*x);
		}while (fabs (x*x*x - (double)q) >= 0.00001*(double)q );
		printf ("%.9lf\n", x );
	} // end loop
		
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
const double EPS = 1e-10;

signed main() {
	cout << setprecision(8) << endl;
	double q;
	while (cin >> q, q != -1) {
		double x = q / 2;
		while (abs(x*x*x - q) >= (1e-6)*q) {
			x = x - ((x*x*x - q) / (3 * x*x));
		}
		cout << x << endl;
	}
	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(){
	int q;
	while(1){
		cin>>q;
		if(q==-1)break;
		double x=q/2;
		while(true){
			if(fabs(pow(x,3.0)-q)< 0.00001*q)break;
			x =x-(pow(x,3.0)-q)/(3*pow(x,2.0));
		}
		printf("%,7f\n",x);
	}

	return 0;
}

C++: #include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
int main(){
  double q;
  while(cin >> q && q != -1){
    double x = q / 2;
    while(true){
      if(fabs(x * x * x * q) < 0.00001 * q) break;
      x -= (x * x * x - q)/(x * x * 3);
    }
    cout << fixed << setprecision(7) << x << endl;
  }
}

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 = 1e-10;
const double pi = acos(-1);
const double inf = (int)1e5;

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

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

double thirdRoot(int q)
{
    if (q == 1) {
        return 1.;
    }

    double xn = q / 2;
    double xn2 = xn;
    double limit = q * 0.00001;
    while (true) {
        xn2 = xn - (xn*xn*xn - q) / (3*xn*xn);
        if (fabs(xn2*xn2*xn2 - q) < limit) {
            break;
        }
        xn = xn2;
    }

    return xn2;
}

int main()
{
    int q;
    while (true) {
        scanf("%d", &q);
        if (q < 0) {
            break;
        }
        printf("%6lf\n", thirdRoot(q));
    }

    return 0;
}

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

#define EPS 1e-5

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