Your First Function
Completed
Complete int cube(int x). The starter reads a number and prints cube(n).
Input
One integer.
Output
Its cube.
Example
Input
3
Output
27
Editor
C++
Hints
return sends the result back to the caller.
Solution explanation
A function's return type is written before its name.
Show solution
#include <iostream>
using namespace std;
int cube(int x) {
return x * x * x;
}
int main() {
int n;
cin >> n;
cout << cube(n) << "\n";
return 0;
}