Question: Question 1 [ 2 5 marks ] Write a C + + program that reads the radius ( r ) , height 1 ( h

Question 1[25 marks]
Write a C++ program that reads the radius (r), height1(h1), and height2(h2) as real (floating-point) numbers. The program should validate that all values are positive real numbers; if any value is negative, the program should report that the data entered is invalid. After validating the input, calculate the surface area (surfaceArea) of a cone with a circular base. The program should then display, with descriptive labels, the radius, height1, height2, base area, and surface area.
Area = base Area + Lateral Area =2rh1+r2+rh22+r22orr(2h1+r+h22+r22)
Question 1 [ 2 5 marks ] Write a C + + program

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!