In lab we learned that functions can return values. For example: ----------------------------------------------------- #include using namespace std; int cubed(int x){ return x*x*x; } int main(){ int y; cin >> y; cout << cubed(y); return 0; } ----------------------------------------------------- With an input of 2, you should get the answer 8 on the screen. We also learned the difference between pass-by-value and pass-by-reference. For example: ----------------------------------------------------- #include using namespace std; int cubed(int x){ //pass by value x = x*x*x; return x; } int cubed2(int &x){ //pass by reference x = x*x*x; return x; } int main(){ int y; cin >> y; cout << cubed(y) << endl; cout << y << endl; cout << cubed2(y) << endl; cout << y << endl; return 0; } ----------------------------------------------------- With an input of 2, you should get the following: 8 2 8 8 ----------------------------------------------------- With the above, do the following problems: 1) Write a program to calculate n! with a function that returns the final answer. 2) Write a function that takes in 2 numbers from the user and reflects the answer in main (pass by reference). 3) Write a function that calculates the hypotenuse of a right triangle and returns the answer. 4) Write a function that swaps two numbers and reflects the change back in main. ----------------------------------------------------- You only need one program [main] to test each of the functions. You can also use (2) to get the numbers for (3) and (4). ==================================================== Due: TBA