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>
#include <cmath>
using namespace std;
double eps, alterX;
int q;

double formula() {
    return(alterX - ((alterX*alterX*alterX - q) / (3 * (alterX*alterX))));
}

void solve() {
    while(alterX*alterX*alterX - q > eps) {
        alterX = formula();
    }
    
}

void output(double ans) {
    printf("%.6f\n", ans);
}

int main(void) {
    while(cin >> q, q != -1) {
        alterX = q / 2.0; //X1
        eps = q / 100000.0; //EPS
        solve();
        output(alterX);
    }
}

C++: #include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
using namespace std;
int main(void)
{
    double q, x, eq;
    while(scanf("%lf",&q),q>0)
    {
        x = q/2;
        eq = q*0.00001;
        while(fabs(x*x*x-q) >= eq)
            x -= (x*x*x-q)/(3*x*x);
        printf("%f\n", x);
    }
    return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
#include <iomanip>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

int main()
{
	double q;
	while(cin >> q && q + 1)
	{
		double x = abs(q / 2);
		while(abs(x * x * x - q) >= 0.00001 * q)
			x = x - (x * x * x - q) / (3 * x * x);
		printf("%.6f\n", pow(q, 1.0 / 3.0));
	}
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
#define EPS 1e-9
using namespace std;

double eps, alterX;
int q;

//漸化式
double formula() {
    return(alterX - ((alterX*alterX*alterX - q) / (3.0 * (alterX*alterX))));
}
//ループ
void solve() {
    while(sqrt(alterX*alterX*alterX - q) > eps) { //|x^3 - q| <= epsの時終了
        alterX = formula();
    }
}
//出力
void output(double ans) {
    printf("%.6lf\n", ans);
}

int main(void) {
    while(cin >> q, q != -1) {
        alterX = q / 2.0; //X1
        eps = sqrt(q * 0.00001); //EPS
        
        solve();
        output(alterX);
    }
    return(0);
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <stack>
#include <string>
#include <queue>
#include <algorithm>
#include <functional>
#define _USE_MATH_DEFINES
#include <math.h>
#include <string.h>

using namespace std;
static const double EPS = 1e-6;


void solve()
{
	int q;
	while (cin >> q, q != -1)
	{
		double left = 0.0;
		double right = 1 << 24;
		for (int i = 0; i < 100; ++i)
		{
			double mid = (left + right) / 2;
			if (q - mid * mid * mid > EPS)
			{
				left = mid;
			}
			else
			{
				right = mid - 0.0001;
			}
		}
		printf("%.6f\n", left);
	}
}

int main()
{
	solve();
	return(0);
}

C++: #include <bits/stdc++.h>
using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main() {
  int q;

  while(cin >> q, q != -1) {
    double x = q/2;
    while(!(abs(x*x*x-q) < 0.00001*q)) {
      x -= (x*x*x-q)/(3*x*x);
    }
    printf("%lf\n", x);
  }  
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main() {
	double q;
	while (cin >> q) {
		if (q == -1)return 0;
		double x = q / 2;
		while (abs(x*x*x - q) >= 0.00001*q) 
			x = x - ((x*x*x - q) / (3 * x*x));
		cout << x << endl;
		cout << x*x*x << endl;
	}
}

C++: #include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
double ZKS(double x,int  q){
	return (x - ((x * x * x) - q) / (3 * x * x));
}

int main(void){
	int q;

	while(cin >> q){
		if(q == -1) break;

		double x1 = q / 2;
		double x = x1;

		while(abs(x * x * x - q) > 0.00001 * q){
			x = ZKS(x,q);
		}

		std :: cout << std :: fixed;
		std :: cout << setprecision(6) << x << endl;
	}

	return 0;
}

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

double thirdRoot(double x, double q){
	double next_x;
	if (fabs(x*x*x - q) < 0.00001*q) {
		return x;
	}else {
		next_x = x - ((x*x*x-q) / (3.0*x*x));
		return thirdRoot(next_x, q);
	}
}

int main(){
	double n;

	while (cin >> n) {
		if (n == -1) {
			break;
		}
		cout << setprecision(20);
		cout << thirdRoot(n/2.0, n) << endl;
		
	}
	return 0;
}

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

int main() {
    while (true) {
        int q;
        cin >> q;
        if (q == -1) return 0;
        double x = q / 2.0;
        for ( ; ; ) {
            double res = x * x * x - q;
            if (fabs(res) < 0.00001 * q) break;
            double xnext = x - res / (3 * x * x);
            x = xnext;
        }
        printf("%.6lf\n", x);
    }
}

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

using namespace std;

double third_root(double xn, double q){
    if((xn*xn*xn-q)>-0.00001  &&  (xn*xn*xn-q)<0.00001){
        return xn;
    }
    
    xn = xn-((xn*xn*xn-q))/(3*xn*xn);
    return third_root(xn, q);
    
}


int main(void)
{
    int q;
    while(cin>>q){
        if(q==-1)break;
        cout<<setprecision(7)<<third_root((double)q/2, (double)q)<<endl;;
    }

    
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
using namespace std;
double q;
double cal(double n){
  double ans;
  while(1){
    ans = n - n/3.0 - q/(3.0*n*n);
    if(fabs(fabs(ans*ans*ans)-fabs(q)) < 0.0000000001){
      return fabs(ans);
    }
    n = ans;    
  }
}

int main(){
  while(cin >> q,q != -1){
    cout  << fixed << setprecision(7) << cal(q/2.0) << endl;
  }
  return 0;
}