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
A-mn has a cubic structure with a0 0.8931 nm and a density of 7.47 g/cm3. b-mn has a different cubic structure, with a0 0.6326 nm and a density of 7.26 g/cm3. the atomic weight of manganese is 54.938 g/mol and the atomic radius is 0.112 nm. determine the percent volume change that would occur if a-mn transforms to b-mn.
Answers: 2
question
Engineering, 04.07.2019 18:10
Ahot wire operates at a temperature of 200°c while the air temperature is 20°c. the hot wire element is a tungsten wire of 5 um diameter and 2 mm in length. plot using excel current, heat transfer and heat generated by the wire for air velocity varying from 1-10 m/s in steps of lm/s? matlab the sensor voltage output, resistance, or assume nu 0.989 re033pr13 take air properties at tr (200°c20°c)/2 = 110°c properties of tungsten: c 0.13 kj/kg.k 3 p 19250 kg/m k (thermal conductivity) = 174 w/m.k
Answers: 2
question
Engineering, 04.07.2019 18:20
Most leaks in reciprocating air compressors can be detected and minimized by: (clo4) a)-detecting leakage areas using ultrasonic acoustic detector. b)-tightening joints and connections c)-replacing faulty equipment d)-all of the given options
Answers: 2
question
Engineering, 04.07.2019 18:20
Steam enters a converging nozzle at 3.0 mpa and 500°c with a at 1.8 mpa. for a nozzle exit area of 32 cm2, determine the exit velocity, mass flow rate, and exit mach number if the nozzle: negligible velocity, and it exits (a) is isentropic (b) has an efficiency of 94 percent
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, 30.04.2021 21:00
question
World Languages, 30.04.2021 21:00
question
History, 30.04.2021 21:00
question
Mathematics, 30.04.2021 21:00
question
Mathematics, 30.04.2021 21:00
Questions on the website: 13722361