Question: Write a C + + code to calculate the surface area of a cone. This program reads input ( radius and height ) from the

Write a C++ code to calculate the surface area of a cone. This program reads input (radius
and height) from the keyboard and prints the area of the cone on the screen.
The surface area of the cone is represented as:
A=r(r+r2+h22) where
r is the radius, h is the height, and is 3.14.
a. Declare a constant variable named PI and assign 3.14 to the constant variable.
b. Using cout and cin, Prompt for and read in the value of radius from the keyboard.
c. Using cout and cin, Prompt for and read in the value of vertical height from the keyboard.
d. Compute the surface area of the cone using the equation mentioned above.
More Hints:
You should use pow () function to calculate r2 and h2. A sqrt () function is used
to compute the square root. To enable these functions, you need to include appropriate
math library.
Use floating point datatype for radius, height, and area.
Write a C + + code to calculate the surface area

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!