Computers and Technology
Computers and Technology, 11.11.2019 21:31, math3130

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;

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 18:30, Jessieeeeey
Kto rozmawia z clamentain przez krótkofalówke w the walking dead która śledzi lee w 4 epizodzie
Answers: 1
image
Computers and Technology, 23.06.2019 11:00, jolleyrancher78
What are the possible consequences of computer hacking? what is computer piracy? describe some examples. what are the effects of computer piracy? what are the possible consequences of computer piracy? what is intentional virus setting? describe some examples. what are the effects of intentional virus setting? what are the possible consequences of intentional virus setting? what is invasion of privacy? describe some examples. what are the effects of invasion of privacy? what are the possible consequences of invasion of privacy? what is an acceptable use policy and what is the purpose of the acceptable use policy what is intellectual property and how can you use it?
Answers: 1
image
Computers and Technology, 23.06.2019 14:30, rose6038
Select the correct answer. peter has launched a website that features baby products. however, clients often find they are unable to access the website because the server is down. which feature of cybersecurity should peter focus on for his website? a. data authenticity b. data privacy c. data availability d. data integrity e. data encryption
Answers: 3
image
Computers and Technology, 23.06.2019 20:30, maryanapritchak1829
If chris has a car liability insurance, what damage would he be covered for
Answers: 1
Do you know the correct answer?
4. the statements in the following program are in incorrect order. rearrange the statements so that...

Questions in other subjects: