Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

/* Menu with Switch Create the following menu: A: area of a circle B: area of a triangle C: area of a rectangle anything else

/* Menu with Switch Create the following menu: A: area of a circle B: area of a triangle C: area of a rectangle anything else - quit Use a SWITCH statement to test the user input. Print out the choice (i.e. if the user enters a B, then print out "You want the area of a triangle."*/ #include using namespace std; int main() { //Variable int choice; double circle, triangle, rectangle ; //displaying menu choice cout << "A: Area of a Circle "; cout << "B: Area of a Triangle "; cout << "C: Area of a Rectangle "; cout << "D: Quit "; // choices cout << "Enter your choices(A-D): "; cin >> choice; //responding to the user choice switch (choice) CIRCLE: // inputting CIRCLE cout << "You want the Area of the circle "; break; TRIANGLE: // input the triangle cout << "Enter the Triangle "; cout << "Area of Rectangle is " << area; } break; RECTANGLE: // input the rectangle cout << "Area of A recTangle "; cin >> rectangle; if (rectangle > 0) { cout << "Area of rectangle is " << area; } else cout << "An Error Message "; break; default: cout << " quit the program . "; } Return 0; }

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

How To Make A Database In Historical Studies

Authors: Tiago Luis Gil

1st Edition

3030782409, 978-3030782405

More Books

Students also viewed these Databases questions