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 17:00
Which of the following is not contained on the slide show toolbar? a. next button b. slide button c. close button d. pen too
Answers: 2
question
Computers and Technology, 23.06.2019 09:00
Which best compares appointments and events in outlook 2010appointments have a subject man, and events do notappointments have a specific date or range of dates, and events do notappointments have a start and end time of day, and events do notappointments have a location option, and events do not
Answers: 2
question
Computers and Technology, 23.06.2019 11:30
Me dangers of social media and the internetexplain what each means: 1) social media and phones have become an addiction.2) outside people have access to you all the time.3) cyberstalking4) cyberbullying5) catphishing6) viruses7) identity theft8) credit card fraud9) hacking10) money schemes
Answers: 1
question
Computers and Technology, 23.06.2019 22:30
You draw two cards from a standard deck of 52 cards, but before you draw the second card, you put the first one back and reshuffle the deck. (a) are the outcomes on the two cards independent? why?
Answers: 3
You know the right answer?
4. the statements in the following program are in incorrect order. rearrange the statements so that...
Questions
question
Mathematics, 23.10.2021 14:00
question
Mathematics, 23.10.2021 14:00
question
Mathematics, 23.10.2021 14:00
Questions on the website: 13722360