using namespace std;
float num, ans;
cout << "Enter the num";
cin >> num;
ans = cbrt(num);
cout << "\n Cube root of " << num << " is: " << ans;
Enter the num 5
Cube root of 5 is: 1.70998
What is cmath function in c++ program
The cmath> header file in C++ provides a set of functions for performing mathematical operations, such as sqrt() for calculating the square root, log() for finding the natural logarithm of a number, and so on.
What is cbrt() function in c++ program
std::cbrt() is a built-in function in the C++ STL that calculates the cube root of an integer. It takes an integer as an argument and returns the number’s cube root. A number’s cube root is a value that, when multiplied by itself three times, returns the original value. For example, the cube root of 27, written as 327, is 3, because we get 3 x 3 x 3 = 27 = 33 when we multiply 3 by itself three times.