subject

4. the statements in the following program are in incorrect order. rearrange the statements so that they prompt the user to input the shape type (rectangle, circle, or cylinder) and the appropriate dimension of the shape. the program then outputs the following information about the shape: for a rectangle, it outputs the area and perimeter; for a circle, it outputs the area and circumference; and for a cylinder, it outputs the volume and surface area. after rearranging the statements, your program should be properly indented.

this is the code:

using namespace std;
#include
#include
#define pi 3.14159
int main()
{
string shape;
double height, radius;
cout < < "enter the shape type: (rectangle, circle, cylinder) ";
cin > > shape;
cout < < endl;
if (shape == "rectangle")
{
cout < < "enter the width of the rectangle: ";
cin > > width;
cout < < "enter the height of the rectangle: ";
cin > > height;
cout < < "area of the rectangle = " < < height * width < < endl;
cout < < "perimeter of the rectangle = " < < 2 * (height + width) < < endl;
}
if (shape == "circle")
{
cout < < "enter the radius of circle: ";
cin > > radius;
cout < < "area of the circle = " < < pi * pow(radius, 2.0) < < endl;
cout < < "perimeter of circle = " < < pi * radius * 2.0 < < endl;
}
if (shape == "cylinder")
{
cout < < "enter the radius of cylinder: ";
cin > > radius;
cout < < "enter the height of the cylinder: ";
cin > > height;
cout < < endl;
cout < < "volume of the cylinder = " < < pi * pow(radius, 2.0) * height < < endl;
cout < < "surface area of cylinder = " < < ( 2 * pi * pow(radius, 2.0) ) + ( pi * radius * 2.0 * height ) < < endl;
}
cout < < endl;

i'm getting the following errors when i compile the application:

using namespace std;
#include
#include
#define pi 3.14159
int main()
{
string shape;
double height, radius;
cout < < "enter the shape type: (rectangle, circle, cylinder) ";
cin > > shape;
cout < < endl;
if (shape == "rectangle")
{
cout < < "enter the width of the rectangle: ";
cin > > width;
cout < < "enter the height of the rectangle: ";
cin > > height;
cout < < "area of the rectangle = " < < height * width< < endl;
cout < < "perimeter of the rectangle = " < < 2 * (height + width) < < endl;
}
if (shape == "circle")
{
cout < < "enter the radius of circle: ";
cin > > radius;
cout < < "area of the circle = " < < pi * pow(radius, 2.0)< < endl;
cout < < "perimeter of circle = " < < pi * radius * 2.0< < endl;
}
if (shape == "cylinder")
{
cout < < "enter the radius of cylinder: ";
cin > > radius;
cout < < "enter the height of the cylinder: ";
cin > > height;
cout < < endl;
cout < < "volume of the cylinder = " < < pi * pow(radius, 2.0) * height < < endl;
cout < < "surface area of cylinder = " < < ( 2 * pi * pow(radius, 2.0) ) + ( pi * radius * 2.0 * height ) < < endl;
}
cout < < endl;

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 13:00
Why the bear has a slunky tail determine the meaning of the word slunk in the story
Answers: 1
question
Computers and Technology, 22.06.2019 20:00
What statement best describes operating systems? it’s possible for modern computers to function without operating systems. most operating systems are free or very inexpensive. operating systems are managed by the computer’s microprocessor (cpu). operating systems manage the computer’s random access memory (ram).
Answers: 1
question
Computers and Technology, 24.06.2019 02:30
Which option completes the explanation for conflict of interest in an organization
Answers: 1
question
Computers and Technology, 24.06.2019 20:30
Which key should you press to leave the cell as it originally was? a. delete b. cancel c. backspace d. enter
Answers: 1
You know the right answer?
4. the statements in the following program are in incorrect order. rearrange the statements so that...
Questions
question
Mathematics, 13.04.2021 17:30
question
Mathematics, 13.04.2021 17:30
question
Mathematics, 13.04.2021 17:30
question
History, 13.04.2021 17:30
question
Mathematics, 13.04.2021 17:30
question
Business, 13.04.2021 17:30
question
Mathematics, 13.04.2021 17:30
Questions on the website: 13722361