subject
Engineering, 18.03.2020 04:01 globalremix

The statements in the file main. cpp are in incorrect order.

Rearrange the statements so that they prompt the user to input:

The shape type (rectangle, circle, or cylinder)
The appropriate dimension of the shape.
Note: For grading purposes place the cylinder height statement before the radius statement.

The C++ 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
For a cylinder, it outputs the volume and surface area.
After rearranging the statements, your program should be properly indented.

Here is the code out-of-order:

using namespace std;

#include

int main()
{
string shape;
double height;
#include

cout << "Enter the shape type: (rectangle, circle, cylinder) ";
cin >> shape;
cout << endl;

if (shape == "rectangle")
{
cout << "Area of the circle = "
<< PI * pow(radius, 2.0) << endl;

cout << "Circumference of the circle: "
<< 2 * PI * radius << endl;

cout << "Enter the height of the cylinder: ";
cin >> height;
cout << endl;

cout << "Enter the width of the rectangle: ";
cin >> width;
cout << endl;

cout << "Perimeter of the rectangle = "
<< 2 * (length + width) << endl;
double width;
}

cout << "Surface area of the cylinder: "
<< 2 * PI * radius * height + 2 * PI * pow(radius, 2.0)
<< endl;
}
else if (shape == "circle")
{
cout << "Enter the radius of the circle: ";
cin >> radius;
cout << endl;

cout << "Volume of the cylinder = "
<< PI * pow(radius, 2.0)* height << endl;
double length;
}
return 0;

else if (shape == "cylinder")
{
double radius;

cout << "Enter the length of the rectangle: ";
cin >> length;
cout << endl;

#include

cout << "Enter the radius of the base of the cylinder: ";
cin >> radius;
cout << endl;

const double PI = 3.1416;
cout << "Area of the rectangle = "
<< length * width << endl;
else
cout << "The program does not handle " << shape << endl;
cout << fixed << showpoint << setprecision(2);
#include

ansver
Answers: 1

Another question on Engineering

question
Engineering, 04.07.2019 18:10
Steel is coated with a thin layer of ceramic to protect against corrosion. what do you expect to happen to the coating when the temperature of the steel is increased significantly? explain.
Answers: 1
question
Engineering, 04.07.2019 18:10
Aplate clutch has a single pair of mating friction surfaces 250-mm od by 175-mm id. the mean value of the coefficient of friction is 0.30, and the actuating force is 4 kn. a) find the maximum pressure and the torque capacity using the uniform-wear model. b) find the maximum pressure and the torque capacity using the uniform-pressure model.
Answers: 3
question
Engineering, 04.07.2019 19:10
Asteel wire of 2 mm diameter is fixed between two points located 2 m apart. the tensile force in the wire is 250n, if its density of steel is given by 7830 kg/m3 the fundamental frequency of vibration hz? ?
Answers: 3
question
Engineering, 04.07.2019 19:10
Agas contained within a piston-cylinder assembly e end nation about same energy states, 1 and 2, where pi 10 bar, v undergoes two processes, a and b, between the sam 0.1 m3, ui-400 kj and p2 1 bar, v2 1.0 m2, u2 200 kj: process a: process from 1 to 2 during which the pressure- volume relation is pv constant process b: constant-volume process from state 1 to a pressure of 2 bar, followed by a linear pressure-volume process to +20 0 state 2 kinetic and potential energy effects can be ignored. for each of the processes a and b, (a) sketch the process on p-v coordinates, (b) evaluate the work, in kj, and (c) evaluate process the heat transfer, in kj
Answers: 2
You know the right answer?
The statements in the file main. cpp are in incorrect order.

Rearrange the statements so...
Questions
question
Mathematics, 14.06.2021 14:00
question
World Languages, 14.06.2021 14:00
question
Mathematics, 14.06.2021 14:00
question
Mathematics, 14.06.2021 14:00
question
Mathematics, 14.06.2021 14:00
question
World Languages, 14.06.2021 14:00
question
Computers and Technology, 14.06.2021 14:00
Questions on the website: 13722362