Problem

Consider the following C++ code: #include #include #include using namespace std;...

Consider the following C++ code:

#include

#include

#include

using namespace std;

void func1();

void func2(/*formal parameters*/);

int main()

{

int num1, num2;

double num3;

int choice;

cout << fixed << showpoint << setprecision(2);

do

{

func1();

cin >> choice;

cout << endl;

if (choice == 1)

{

func2(num1, num2, num3);

cout << num1 << ", " << num2 << ", " << num3 << endl;

}

}

while (choice != 99);

return 0;

}

void func1()

{

cout << "To run the program, enter 1." << endl;

cout << "To exit the pogram, enter 99." << endl;

cout << "Enter 1 or 99: ";

}

void func2(/*formal parameters*/)

{

//Write the body of func2.

}

The function func2 has three parameters of type int, int, and double, say a, b, and c, respectively. Write the definition of func2 so that its action is as follows:

a. Prompt the user 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, ab.

ii. If a < b, the value assigned to c is b to the power a, that is, ba.

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.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT