C ++ cbrt () - C ++ standaardbibliotheek

De functie cbrt () in C ++ geeft de kubuswortel van een getal terug.

 (Wiskunde) ∛x = cbrt (x) (In C-programmering)

Deze functie is gedefinieerd in het header-bestand.

cbrt () prototype (vanaf C ++ 11-standaard)

dubbele cbrt (dubbele x); float cbrt (float x); lange dubbele cbrt (lange dubbele x); dubbele cbrt (T x); // Voor integraal type

cbrt () Parameters

De functie cbrt () accepteert één argument waarvan de kubuswortel moet worden berekend.

cbrt () Retourwaarde

De functie cbrt () retourneert de kubuswortel van het opgegeven argument.

Voorbeeld 1: Hoe werkt cbrt () in C ++?

 #include #include using namespace std; int main() ( double x = -1000.0, result; result = cbrt(x); cout << "Cube root of " << x << " is " << result << endl; return 0; ) 

Wanneer u het programma uitvoert, is de uitvoer:

 Kubuswortel van -1000 is -10

Voorbeeld 2: cbrt () functie met integraal argument

 #include #include using namespace std; int main() ( long x = 964353422; double result = cbrt(x); cout << "Cube root of " << x << " is " << result << endl; return 0; ) 

Wanneer u het programma uitvoert, is de uitvoer:

 Kubuswortel van 964353422 is 987,974

Interessante artikelen...