Question: Part 2 (Calculating Circle Circumference, Circle Area or Sphere Volume Using Function Pointers) Create a text-based, menu-driven program that allows the user to choose whether

 Part 2 (Calculating Circle Circumference, Circle Area or Sphere Volume Using

Part 2 (Calculating Circle Circumference, Circle Area or Sphere Volume Using Function Pointers) Create a text-based, menu-driven program that allows the user to choose whether to calculate the circumference of a circle, the area of a circle or the volume of a sphere. The program should then input a radius from the user, perform the appropriate calculation and display the result. Use an array of function pointers in which each pointer represents a function that returns void and receives a double parameter. The corresponding functions should each display messages indicating which calculation was performed, the value of the radius and the result of the calculation. Use the constant value 3.14159 for . Call the program part2. c Use the code in Fiqure 7.28 of the book (Demonstrating an array of pointers to functions) as a model Use the while loop to process the user's choice (as in Figure 7.28). When the user enters 0 the circumference of a circle should be computed. When the user enters 1, the area of a circle should be computed. When the user enters 2, the volume of a sphere should be computed. When the user enters 3, the program should terminate Sample run of the program may look like the following Enter 0 for circumference, 1 for area, 2 for volume, 3 to end: 1 Please enter radius: 2 The area of a circle is computed Radius: 2.000000 Area: 12.566360 Enter 0 for circumference, 1 for area, 2 for volume, 3 to end: 0 Please enter radius: 1 The circumference of a circle is computed Radius:1.000000 Circumference: 6.283180 Enter 0 for circumference, 1 for area, 2 for volume, 3 to end: 2 Please enter radius: 3 The volume of a sphere is computed Radius: 3.000000 Volume: 113.097240 Enter 0 for circumference, 1 for area, 2 for volume, 3 to end: 3 Program execution completed

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!