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 <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        int q;
        cin >> q;
        if(q == -1)
            return 0;

        double x = q / 2.0;
        while(abs(pow(x, 3) - q) >= 0.00001*q)
            x -= (pow(x, 3) - q) / (3 * pow(x, 2));

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

C++: #include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
	int n;
	while(cin >>n){
		if(n == -1){break;}
		double x = n/2;
		for(;;){
			if(fabs(x*x*x-n)<0.00001*n){break;}
			x = x-(x*x*x-n)/(3*x*x);
		}
		printf("%.6lf\n",x);
	}
	return 0;
}

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

int main()
{
	int n;
	while(cin >> n,n != -1)
	{
		double q = n/2.0;
		double end = sqrt(0.00001*q);

		while(fabs(sqrt((q*q*q) - n)) >= end)
		{
			q = q - ((q*q*q - n) / (3*q*q));
		}

		cout << fixed;
		cout.precision(6);
		cout << q << endl;
			
	}
	return 0;
}

C++: #include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define rep(a,t) for(int a=0;a<t;a++) 
#define forever while(true)
#define Sort(a) sort(a.begin(),a.end())
#define Reverse(a) reverse(a.begin(),a.end())
#define pb push_back
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
    ld a = 0;
	while (true) {
		cin >> a;
		if (a == -1) { break; }
		ld x = (ld)a / (ld)2.00000000000000000000000;
		while ((ld)abs((ld)x *(ld)x * (ld)x - (ld)a) >=(ld) 0.00001*(ld)a) {
			x =(ld) x -(ld) (x * x * x - (ld)a) / (ld)((ld)3.00 * x * x);
		}
		cout << x << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
long long int in;
while(cin>>in,in+1){
long double x=in/2;
while(x*x*x-in>0.000000001*in||x*x*x-in<-0.000000001*in)
x-=(x*x*x-in)/(3*x*x);
printf("%.9llf\n",x);
}
}

C++: #include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
typedef complex<double> P;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 29;
static const LL LL_INF = 1ll << 60;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };

#ifdef WIN32
#define dump(x) cout << #x << " = " << (x) << "\n"
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n"
#else
#define dump(x)
#define debug(x)
#endif

int n;

void solve() {
	double now = n / 2.0;
	while ( fabs( sq( now ) * now - n ) >= 0.00001 * now ) {
		now -= ( sq( now ) * now - n ) / ( 3 * sq( now ) );
	}
	printf( "%f\n", now );
}

int main() {
#ifdef WIN32
	printf( "Debug Mode\n" );
#endif
	while ( ~scanf( "%d", &n ) && ~n ) {
		solve();
	}
	return 0;
}

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

double ans(int q,long double x){
	x=x-(x*x*x-q)/(3*x*x);
	if(x*x*x-double(q)<0.00001*double(q)){
		return x;
	}else{
		return ans(q,x);
	}
	
}


int main(){
	int q;
	long double x;
	while(scanf("%d",&q),q!=-1){
		x=ans(q,double(q)/2);
		cout<<x<<endl;
	}
}

C++: #include<iostream>
#include<iomanip>
#include<math.h>
using namespace std;

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

C++: #include <bits/stdc++.h>
using namespace std;
//typedef unsigned double d;
double temp(double,double);

double temp(double x,double q){
    x-=(x*x*x-q)/(3*x*x);
    return x;
}

int main(){
    double x[50],q;
    int i;
    for(i=0;i<50;i++){
        cin>>q;
        if(q==-1)break;
        x[i]=q/2;
        do{
            x[i]=temp(x[i],q);
        }while(fabs(x[i]*x[i]*x[i]-q)>=1e-5*q);
    }
    for(int j=0;j<i;j++){
        printf("%.6f,\n",x[j]);
    }
}

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

int main(){
	double q, x;
	while(std::cin >> q, q != -1){
		x = q/2;
		while(fabs(x*x*x-q) >= 0.00001*q){
			x = x - (x*x*x-q) / (3*x*x);
		}
		printf("%.6lf\n", x);
	}
}

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

using namespace std;

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

}

int main(){

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

C++: #include<bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long int ll;
const ll MOD=1000000007;
const ll INF=1000000010;
const ll LINF=4000000000000000010LL;
const int MAX=310;
const double EPS=1e-8;
int dx[4]={0,0,1,-1};
int dy[4]={-1,1,0,0};
int main(){
	double q;
	while(cin>>q,q!=-1){
		double dp[100010];
		dp[0]=q/2;
		for(int i=0;i<100000;i++){
			dp[i+1]=dp[i]-(pow(dp[i],3)-q)/(3*pow(dp[i],2));
		}
		printf("%.8lf\n",dp[100]);
	}
		
}

C++: #include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;
int x, cnt; double sum[10000];
int main() {
	while (true) {
		cin >> x; if (x == -1) { break; }
		sum[0] = x / 2.0; cnt = 0;
		while (abs(x - sum[cnt] * sum[cnt] * sum[cnt]) > 0.00001*x) {
			cnt++;
			sum[cnt] = sum[cnt - 1] - ((sum[cnt - 1] * sum[cnt - 1] * sum[cnt - 1] - x) / (3 * sum[cnt - 1] * sum[cnt - 1]));
		}
		cout << fixed << setprecision(20) << sum[cnt] << endl;
	}
}