亚洲区国产区激情区无码区,国产成人mv视频在线观看,国产A毛片AAAAAA,亚洲精品国产首次亮相在线

C++ 基礎(chǔ)教程

C++ 流程控制

C++ 函數(shù)

C++ 數(shù)組 & 字符串

C++ 數(shù)據(jù)結(jié)構(gòu)

C++ 類 & 對(duì)象

C++ 指針

C++ 繼承

C++ STL 教程

C++ 參考手冊(cè)

C++ cbrt() 函數(shù) 使用方法及示例

C++ 庫(kù)函數(shù) <cmath>

C ++中的cbrt()函數(shù)返回?cái)?shù)字的立方根。

 ?x = cbrt(x)

此函數(shù)在<cmath>頭文件中定義。

cbrt()原型[從C ++ 11標(biāo)準(zhǔn)開(kāi)始]

double cbrt(double x);
float cbrt(float x);
long double cbrt(long double x);
double cbrt(T x); // For integral type

cbrt()參數(shù)

cbrt()函數(shù)采用一個(gè)要計(jì)算其立方根的參數(shù)。

cbrt()返回值

cbrt()函數(shù)返回給定參數(shù)的立方根。

示例1:cbrt()如何在C ++中工作?

#include <iostream>
#include <cmath>
using namespace std;

int main()
{
    double x = -1000.0, result;
    result = cbrt(x);
    cout << "-1000 的立方根是 " << result << endl;

    return 0;
}

運(yùn)行該程序時(shí),輸出為:

-1000的立方根是 -10

示例2:帶有整型參數(shù)的cbrt()函數(shù)

#include <iostream>
#include <cmath>
using namespace std;

int main()
{
    long x = 964353422;
    double result = cbrt(x);
    cout << "964353422的立方根是 " << result << endl;
	
    return 0;
}

運(yùn)行該程序時(shí),輸出為:

964353422的立方根是 987.974

C++ 庫(kù)函數(shù) <cmath>