1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
The function func2 has three parameters of type int, int, and double, say a, b, and c respectively. Write the function func2 so that its action is as follows:
a. Prompt the user to to input two integers and store the numbers in a and b, respectively.
b. If both of the numbers are nonzero:
i. If a >= b, the value assigned to c is a to the power b, that is a ^ b.
ii. If a < b, the value assigned to c is b to the power a, that is b ^ a.
c. If a is nonzero and b is zero, the value assigned to c is the square root of the absolute value of a.
d. If b is nonzero and a is zero, the value assigned to c is the square root of the absolute value of b.
e. Otherwise, the value assigned to c is 0.
The values of a, b, and c are passed back to the calling environment.
After completing the definition of the func2 and writing its function prototype, test run your program.
|