Question: Write a function void powers(int x, double &recip, double &square, double &cube) that will overwrite the 2nd argument with the reciprocal of the first argument,
Write a function
void powers(int x, double &recip, double &square, double &cube)
that will overwrite the 2nd argument with the reciprocal of the first argument, the 3rd argument with the square, and the fourth with the cube. The function SHOULD NOT PRINT anything itself, only main() should print.
Also write a main() program to test it, which prompts the user for a positive integer, and prints the reciprocal, square and cube, after calling the function. Include labels in your printing for each value. Here is an example program run:
Enter a positive integer : 2 Reciprocal: 0.5 Square: 4 Cube: 8
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
