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 <cstdio>
using namespace std;

int q;

bool input() {
	cin >> q;
	if(q == -1)
		return false;
	return true;
}

double solve() {
	double x = (double)q / 2;
	while(fabs(x * x * x - q) >= 0.00001 * q) {
		x = x - x / 3 + q / (3 * x * x);
	}

	return x;
}

int main(void) {
	while(input())
		printf("%.8f\n", solve());
}

C++: #define _USE_MATH_DEFINES
#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 <bits/stdc++.h>
using namespace std;

int main()
{
	cout << fixed << setprecision(20);
	
	int q;
	while (cin >> q, q != -1.0){
		double l = 0, r = 1e9;
		for (int i = 0; i < 100; i++){
			double m = (l + r) / 2;
			if (m * m * m < q) l = m;
			else r = m;
		}
		cout << l << endl;
	}
}

C++: #include<iostream>
#include<iomanip>
#include<cmath>
#include<cstdlib>

const double EPS = 1e-5;

double q;

int main()
{
	while( std::cin >> q, q != -1 )
	{
		double prv = q / 2.0, crt;

		do
		{
			crt = prv - ( pow( prv, 3.0 ) - q ) / ( 3 * pow( prv, 2.0 ) );
			prv = crt;
		}while( fabs( pow( crt, 3.0 ) - q ) >= EPS * q );

		std::cout << std::setprecision( 7 ) << crt << std::endl;
	}

	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 ) > EPS * q ) {
      x = x - ( x*x*x - q ) / ( 3*x*x );
    }
    printf("%f\n", x);
  }
  
  return 0;
}

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

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(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 <iostream>
#include <vector>
#include <cmath>
#include <iomanip>

using namespace std;

double thrt(double q){
  double x=q/2.0;
  while(abs(x*x*x-q)>=0.00001*q){
    x-=(x*x*x-q)/(3.0*x*x);
  }
  return x;
}

int main(){
  vector<double> data;
  double q;
  while(cin>>q&&(q!=-1)){
    data.push_back(q);
  }
  for(auto q:data){
    cout<<setprecision(8)<<thrt(q)<<endl;
  }

}

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

C++: #include<iostream>
#include<string>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
using namespace std;

int main() {

    int q;
    while (cin >> q && q != -1) {
        double x = q / 2.0;
        while (abs(x * x * x - q) >= 0.00001 * q) {
            x = x - (x * x * x - q) / (3 * x * x);
        }
        printf("%.6f", x);
        cout << endl;

    }
     
    return 0;
}

C++: #include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;
int x;
int main() {
	while (true) {
		cin >> x; if (x == -1) { break; }
		cout << fixed << setprecision(20) << pow(1.0*x, 1.0 / 3.0)+0.000001 << endl;
	}
}

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

void solve(long long q) {
    long double x = q / 2.0;
    while(fabs(x*x*x - q) >= 0.00001*q) {
        x = 1.0 * x - (x*x*x - q) / (3 * x*x);
    }
    printf("%.15Lf\n", x);
}

int main() {
    long long q;
    while(~scanf("%lld",&q)) solve(q);
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> P;
static const double EPS = 1e-5;

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

int main(void){
  int q;
  while(cin>>q){
    if(q==-1) break;
    cout<<pow(q,(double)1/3)<<endl;
  }
  return 0;
}

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

int main(){
	
	long long int q;
	double x;
	
	while(cin>>q){
		if(q!=-1){
			x=q/2;
			while(abs(pow(x,3)-q)>=0.00001*q){
				x=x-((pow(x,3)-q)/(3*pow(x,2)));
		}
			printf("%.6f\n",x);
	}
		else
			break;
	
	
}
}

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

int main(){
	double q, x;

	for(double q, x ; scanf("%lf", &q ) , q != -1 ; printf("%f\n" , x ) )
		for( x=q/2.0 ; fabs( x*x*x - q ) > 1e-5*q ; x = x - ( x*x*x-q ) / (3*x*x)  );
}

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

using namespace std;

int main() {
	long long int n;
	while (cin >> n) {
		if (n == -1) {
			break;
		}
		long double q;
		q = (long double)n / 2.0;
		while (q >= 2 << 15 || fabs(q*q*q-n) >= 0.00001*q) {
			q = (2.0 * q / 3.0) + ((n/3.0)/q)/q;
		}
		printf("%.6f\n", q);
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<string>
#include<sstream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cctype>
#include<climits>
using namespace std;
#define REP(i, j) for(int i = 0; i < j; i++)
#define FOR(i, j, k) for(int i = j; i < k; i++)
#define P pair<int, int>
const int INF = INT_MAX / 2;

int main(){
    int q;
    while(cin >>q && q != -1){
        double bef = q / 2;
        double stp = sqrt(0.00001 * q);
        while(sqrt((bef * bef * bef) - q) > stp){
            bef = bef - ((bef * bef * bef - q) / (3 * bef * bef));
        }
        printf("%.6lf\n", bef);
    }
    return 0;
}

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

double t_root(double q){
	double x = q / 2;
	while(max(x * x * x  - q,-(x * x * x - q)) >= 0.000001 * q){
		x = x - (x * x * x - q) / (3 * x * x);
	}
	return x;
}

int main(){
	double q;
	while(cin >> q){
		if(q == -1) break;
		cout <<  t_root(q) << endl;
	}
	return 0;
}