此函数用于查找给定数字的立方根。
Cube root of a number : ∛arg
double cbrt(double arg); float cbrt(float arg); long double cbrt(long double arg); double cbrt(integral arg);
arg : 它是float或整数类型的值。
它返回给定数字arg的立方根。
让我们看一个简单的示例,其中参数" arg"为整数类型
链接:https://www.learnfk.comhttps://www.learnfk.com/c++/cpp-math-cbrt-function.html
来源:LearnFk无涯教程网
#include <iostream> #include<cmath> using namespace std; int main() { int arg=8; std::cout << "Cube root of a number is :" <<cbrt(arg); return 0; }
输出:
Cube root of a number is :2
让我们看一个简单的示例,其中参数" arg"为浮点型。
#include <iostream> #include<cmath> using namespace std; int main() { float arg=12.8; std::cout << "Cube root of a number is :" <<cbrt(arg); return 0; }
输出:
Cube root of a number is :2.33921
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)