Question: How would this code look as a flowchart?? Thank you. int choice = 0; double A, l, w, s, b, h; do { cout <

How would this code look as a flowchart??

Thank you.

int choice = 0; double A, l, w, s, b, h; do { cout << "Enter 1 to calculate the area of a rectangle. "; cout << "Enter 2 to calculate the area of a square "; cout << "Enter 3 to calculate the area of a triangle "; cout << "Enter 4 to quit. "; cin >> choice; if (choice > 4) { cout<<" Please re-enter a number between 1 and 4"; return 0; }

if (choice == 1) { cout << "Please enter the length and width of the rectangle "; cin >> l; cin >> w; A = l * w; cout << "The area of the rectangle is " << A << endl; return 0;

} else if (choice == 2) { cout << "Please enter sides of the square "; cin >> s; cin >> s; A = s * s; cout << "The area of the square is " << A << endl; return 0;

} if (choice == 3) { cout << "Please enter the base and height of the triangle "; cin >> b; cin >> h; A = b * h / 2.0; cout << "The area of the triangle is " << A << endl; return 0; } }

while (choice != 4);

{ if (choice == 4) cout << " Bye!"; return 0; } return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!