Answer:
#include <iostream>
#include <math.h>
using namespace std;
int to_the_power_of(int first, int second){
int result = pow(first, second);
return result;
}
int main()
{
int side;
cout<<"Enter the side of cube: ";
cin>>side;
int volume = to_the_power_of(side, 3);
cout<<"The volume is "<<volume<<endl;
return 0;
}
Step-by-step explanation:
include the library iostream and math.h for using the input/output instruction and pow() function.
create the main function and declare the variable.
then, print the message for asking to enter the value from user.
the enter value is then store in the variable using cin instruction.
then, call the function with two parameters. program control move to the define function and calculate the first parameter raised to the power of the second parameter.
then return the result to the main function and finally print the result.