Question: c++ need help asap plase! 18.25 LAB: Function problem We a C++ program that uses a function to calculate and return the volume of a

18.25 LAB: Function problem We a C++ program that uses a function to calculate and return the volume of a sphere for a sphere with known radius The function should accept the value of the radius when called from main() and return the volume of the sphere to main) For a given sphere with a radius, the volume is given by 4/3 *Pl*r****(4/3 multiplied to PL31415927, multiplied to the cube of radius) Hint Performing a 4/3 for this calculation could result into an integer result, so, care must taken to avoid an integer result. Also, you should use PI = 3,1415927 for this lab's calculations You should read the value of the sphere's radius in main() as a value entered through user input. Then you should call the function that calculates and returns the value of the volume to main() in main you should print the values of the radius of the sphere and its volume as per the output specified below. The numerical values in the output should print only two digits after the decimal Toint Ex If the input for the radius is: 1.0 the output is Radius of sphere - 1.00, Volume - 4.19 Ex If the input is 5 the output is Radius of sphere - 5.00, Volume - 523.60 ExcIf the input is 3.852 the output is Radius of sphere - 3.85, Volume - 239.41 the output is Radius of sphere - 3.85, Volume = 239.41 IMPORTANT: Your code should be written as specified above (and indicated in the template comments) and work as indicated to be eligible for full points Code that works, but does not use a function as specified in the problem description might get you only partial points. 2106 LAD ACTIVITY 18.25.1. LAB: Function problem 0/5 main.cpp Load default template... 1 include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
