Compute Cube Number

Hi ..
The following is my beginner code that compute cube number n^3, i already use n1*n1*n1 to compute it, is there any function in C++ to do that directly ?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  #include <iostream>

using namespace std;

int main()
{
	float n1;
	float cube;

	cout << "Enter a real number: ";
	cin >> n1;

	cube = n1*n1*n1;

	cout << cube << endl;
	
	system("pause");

}
Topic archived. No new replies allowed.