Question: In C only 7.30 (Calculating Circle Circumference, Circle Area or SphereVolume Using Function Pointers) Using the techniques you learned in Fig. 7.28, create a text-based,menu-driven

In C only

7.30 (Calculating Circle Circumference, Circle Area or SphereVolume Using Function Pointers)

Using the techniques you learned in Fig. 7.28, create a text-based,menu-driven program that allows
the user to choose whether to calculate the circumference of acircle, the area of a circle or the
volume of a sphere.

The program should then input a radius from the user, perform theappropriate calculation and
display the result. Use an array of function pointers in which eachpointer represents a function
that returns void and receives a double parameter. Thecorresponding functions should each display
messages indicating which calculation was performed, the value ofthe radius and the result of the
calculation.

For the purposes of this exercise, assume pi is equal to 3.1415926.In your calculation functions,
display a message that indicates the value for radius read in andthe result of the calculation. In
both cases, display the value to 7 digits of precision.

If the user enters a selection not present on your menu, indicatethe error and try again until a
correct selection is made. Also, do not accept values for theradius that are less than 0.0.

===·Circles·&·Spheres·Menu·===??Please·select·from·the·options·below:??(0)·Calculate·the·circumference·of·a·circle.?(1)·Calculate·the·area·of·a·circle.?(2)·Calculate·the·volume·of·a·sphere.??Enter·your·selection:1?·Enter·the·radius·of·your·figure:5.0?·Calculating·area·of·circle·with·radius·5.0000000...?The·result·is:·78.5398150?

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 Programming Questions!