The std::cbrt() is an inbuilt function in C++ STL which is used to calculate the cube root of number. It accepts a number as argument and returns the cube root of that number.
// Returns cube root num (num can be // of type int, double, long double or // long long type. // The return type is same as parameter // passed. cbrt(num)
Parameter: The parameter can be of int, double, long double or long long type.
Return Value: It returns the cube root of the number num. The datatype of returned cube root is same as that of the parameter passed except when an integer is passed as parameter. If the parameter passed is integral then the cbrt() function will return a value of type double.
Input : 8 Output : 2 Input : 9 Output : 2.08008
Below program illustrate the cbrt() function:
- Difference between Private and Protected in C++ with Example
- Difference between Inheritance and Polymorphism
- Difference between Single and Multiple Inheritance in C++
- Difference between Abstraction and Encapsulation in C++
- return statement in C/C++ with Examples
- C++ Program to Illustrate Trigonometric functions
- How to implement our own Vector Class in C++?
- Web Programming in C++
- C++ Program to print an Array using Recursion
- Storage Classes in C++ with Examples
- fill_n() function in C++ STL with examples
- fill() function in C++ STL with examples
- How to erase an element from a vector using erase() and reverse_iterator?
- iomanip setbase() function in C++ with Examples
- iomanip setpricision() function in C++ with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.