Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

make flowchart for the following code be as detailed as possible #include #include using namespace std; int main() { const int areaCircle = 1, areaRectangle

make flowchart for the following code be as detailed as possible

#include #include

using namespace std; int main() { const int areaCircle = 1, areaRectangle = 2, areaTriangle = 3, Quit = 4; int area = 0, radius, length, width, height, base, choice; double pi = 3.14159; cout << fixed << showpoint << setprecision(4);

do { cout << "1. Calculate the Area of a Circle" << endl; cout << "2. Calculate the Area of a Rectangle" << endl; cout << "3. Calculate the Area of a Triangle" << endl; cout << "4. Quit" << endl; cout << "Enter your choice (1-4):" << endl; cin>>choice; while (choice < areaCircle || choice > Quit){ cout << "Please enter a choices 1-4: "; cin >> choice; } if (choice != Quit) { switch (choice) { case areaCircle: cout<< "What is the radius of the circle"; cin>>radius; if (radius <= 0) { cout<<"Error. The radius must be a positive number"<>radius; } area = pi * radius; break; case areaRectangle: cout<< "What is the length of the rectangle"; cin>>length; if (length <= 0) { cout<<"Error. The length must be a positive number"<>length; } cout<< "What is the width of the rectangle"; cin>>width; if (width <= 0) { cout<<"Error. The width must be a positive number"<>width; area = length * width; } break; case areaTriangle: cout<< "What is the length of the base of the triangle"; cin>>base; if (base <= 0) { cout<<"Error. The base must be a positive number"<>height; } cout<< "What is the height of the triangle"; cin>>height; if (height <= 0) { cout<<"Error. The height must be a positive number"<>height; } area = base * height * 0.5; break; } cout<<"The area is: "<

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What are the benefits of planning for growth?

Answered: 1 week ago