{
unsigned short int x, y;
x = 7;
y = myFunc(x);
std::cout << “x: “ << x << “ y: “ << y << “\n”;
return 0;
}
int myFunc(unsigned short int x);
{
return (4*x);
}
- Write a function that takes two unsigned shortinteger arguments and returns the
result of dividing the first by the second. Do not do the division if the second num-
ber is zero, but do return –1. - Write a program that asks the user for two numbers and calls the function you
wrote in Exercise 5. Print the answer, or print an error message if you get –1. - Write a program that asks for a number and a power. Write a recursive function
that takes the number to the power. Thus, if the number is 2 and the power is 4, the
function will return 16.
136 Day 5