Question
Write a statement that passes the value 4 to the function below and assign it's return value to the variable result. Thank You.
int cube(int num)
{
return num*num*num;
}
int cube(int num)
{
return num*num*num;
}
Answers
MathMate
The given function is of (return) type <i>int</i>, and takes a single argument of <i>int</i>. So if the return value is to be stored, it should be stored in an int variable.
The variable name should start with an alpha character, followed by other optional characters. Note that in C++, variable names are case-sensitive.
Do not forget the ";" at the end of the statement.
int a3=cube(4);
The variable name should start with an alpha character, followed by other optional characters. Note that in C++, variable names are case-sensitive.
Do not forget the ";" at the end of the statement.
int a3=cube(4);