Question: Laboratory # 5 Objectives: To use library functions to evaluate equations. To understand nested loop structures, both 'for' and 'while'. Problem 1 : Add a

Laboratory #5
Objectives: To use library functions to evaluate equations. To
understand nested loop structures,
both 'for' and 'while'.
Problem1:
Add a line that prompts the user to enter the diameter of a sphere.
Read in and store the number into a variable called diameter (you
will need to declare any variables that you use).
The diameter is twice as long as the radius, so calculate and store the
radius in an appropriately named variable.
The formula for the volume of a sphere is: V=43*
Convert the formula to C++ code and add a line which calculates and
stores the value of volume in an appropriately named variable. Use
pow (x,y) to cube the radius.
Print your results to the screen with an appropriate message.
Problem 2:
Using for loops control structure write a program segment to print the
following pattern:
++++,+
++++,++
++++,+++
++++,++++
Problem 3:
Repeat problem 2 using while loop control structures.
Laboratory # 5 Objectives: To use library

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!