牛顿-拉弗森迭代法求解立方根:

#include<iostream>
using namespace std;

int main(){
    double n;
    cin>>n;
    double x = 1;
    double next = x - (x*x*x - n) / (3*x*x);
    while(x - next > 0.000000001 || x - next < -0.000000001){
        x = next;
        next = x - (x*x*x - n) / (3*x*x);
    }
    printf("%.1f\n", x);
    return 0;
}