//Calculate cube of a double number x double cube(double x); //Returns the cube of double x //Reads the number from keyboard and prints cube void get_num_and_print_cube(); //Prints cube of parameter x void print_cube(double x); //Gets a number from keyboard and returns cube double cube_of_input(); //Replaces x with its cube void cube_x(double& x); double cube(double x) { return x*x*x; } void get_num_and_print_cube() { double x; cin >> x; cout << x*x*x; } void print_cube(double x) { cout << x*x*x; } double cube_of_input() { int x; cin >> x; return x*x*x; } void cube_x(double& x) { x = x*x*x; } int main() { double my_x; cout << "The cube of 4 is " << cube(3+1) << endl; my_x = cube(4); my_x = cube(my_x); cout << "Enter a num: "; get_num_and_print_cube(); print_cube(5); cout << "Type a num: "; cout << cube_of_input() << " is the cube" << endl; my_x = 5; cube_x(my_x); cout >> my_x >> endl; } int prod(int m, int n) { assert(m <= n); int product = 1; //The calculated product int i; //Loop variable for(i=m; i<=n; ++i) { product = product*i; } return product; } //Write function that asks the user to type exactly 10 integers //Return value is largest value user typed int largestTyped() { int biggest=0; //The biggest number int i; //Loop variable int next; //Next number typed for(i=1; i<=10; ++i) { cout << "Type next number: "; cin >> next; if(next > biggest) biggest = next; } return biggest; } //Write a function with 2 parameters, a double x and integer n //n is non-negative //x and n are not both zero //Return value is x raised to the nth power //Ex: x=4, n=3, return value=x*x*x=64 // x=0, n=1319, return value=0 // x=294, n=1, return value=x=294 // x=715, n=0, return value=1