e C++ code below     #include   using namespace std;   int main ()   { int first_opt, area_opt, perimeter_opt, length, width, radius, side, height, base, a, b, c, A_Rect, A_Square, P_Rect, P_Square, P_Triangle;   float A_Circle, A_Triangle, P_Circle;       cout<<"Welcome!. Choose what you want to solve"<<"\n";   cout<<"1. AREA"<<"\n"; cout<<"2. PERIMETER"<<"\n";   cin>>first_opt;   cout<<"Choose from the following"<<"\n";   switch(first_opt) { case 1:   cout<<"1. Area of the Rectangle"<<"\n"; cout<<"2. Area of the Circle"<<"\n"; cout<<"3. Area of the Square"<<"\n"; cout<<"4. Area of the Triangle"<<"\n"; cin>>area_opt;    switch(area_opt)  {  case 1:  cout<<"Enter length: "<<"\n";  cin>>length;  cout<<"Enter width: "<<"\n";  cin>>width;  A_Rect = length*width;  cout<<"The area of the rectangle is: "<>radius;  A_Circle = 3.1416*radius*radius;  cout<<"The area of the circle is: "<>side;  A_Square = side*side;  cout<<"The area of the square is: "<>height;  cout<<"Enter base: "<<"\n";  cin>>base;  A_Triangle = (height*base)/2;  cout<<"The area of the triangle is: "<>perimeter_opt;    switch(perimeter_opt)  {  case 1:  cout<<"Enter length: "<<"\n";  cin>>length;  cout<<"Enter width: "<<"\n";  cin>>width;  P_Rect = 2*(length+width);  cout<<"The perimeter of the rectangle is: "<>radius;  P_Circle = 3.1416*radius*2;  cout<<"The perimeter of the circle is: "<>side;  P_Square = 4*side;  cout<<"The perimeter of the square is: "<>a;  cout<<"Enter the length of second side: "<<"\n";  cin>>b;  cout<<"Enter the length of third side: "<<"\n";  cin>>c;    P_Triangle = a+b+c;  cout<<"The area of the triangle is: "<

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Create a flowchart for the C++ code below

 

 

#include <iostream>

 

using namespace std;

 

int main ()

 

{

int first_opt, area_opt, perimeter_opt, length, width, radius, side, height, base, a, b, c, A_Rect, A_Square, P_Rect, P_Square, P_Triangle;

 

float A_Circle, A_Triangle, P_Circle;

 

 

 

cout<<"Welcome!. Choose what you want to solve"<<"\n";

 

cout<<"1. AREA"<<"\n";

cout<<"2. PERIMETER"<<"\n";

 

cin>>first_opt;

 

cout<<"Choose from the following"<<"\n";

 

switch(first_opt)

{

case 1:

 

cout<<"1. Area of the Rectangle"<<"\n";

cout<<"2. Area of the Circle"<<"\n";

cout<<"3. Area of the Square"<<"\n";

cout<<"4. Area of the Triangle"<<"\n";

cin>>area_opt;

 

 switch(area_opt)

 {

 case 1:

 cout<<"Enter length: "<<"\n";

 cin>>length;

 cout<<"Enter width: "<<"\n";

 cin>>width;

 A_Rect = length*width;

 cout<<"The area of the rectangle is: "<<A_Rect<<"\n";

 

 case 2:

 cout<<"Enter radius: "<<"\n";

 cin>>radius;

 A_Circle = 3.1416*radius*radius;

 cout<<"The area of the circle is: "<<A_Circle<<"\n";

 

 case 3:

 cout<<"Enter side: "<<"\n";

 cin>>side;

 A_Square = side*side;

 cout<<"The area of the square is: "<<A_Square<<"\n";

 

 case 4:

 cout<<"Enter height: "<<"\n";

 cin>>height;

 cout<<"Enter base: "<<"\n";

 cin>>base;

 A_Triangle = (height*base)/2;

 cout<<"The area of the triangle is: "<<A_Triangle<<"\n";

 

 default:

 cout<<"out of options";

 break;

 }

break;

 

case 2:

 

cout<<"1. Perimeter of the Rectangle"<<"\n";

cout<<"2. Perimeter of the Circle"<<"\n";

cout<<"3. Perimeter of the Square"<<"\n";

cout<<"4. Perimeter of the Triangle"<<"\n";

cin>>perimeter_opt;

 

 switch(perimeter_opt)

 {

 case 1:

 cout<<"Enter length: "<<"\n";

 cin>>length;

 cout<<"Enter width: "<<"\n";

 cin>>width;

 P_Rect = 2*(length+width);

 cout<<"The perimeter of the rectangle is: "<<P_Rect<<"\n";

 

 case 2:

 cout<<"Enter radius: "<<"\n";

 cin>>radius;

 P_Circle = 3.1416*radius*2;

 cout<<"The perimeter of the circle is: "<<P_Circle<<"\n";

 

 case 3:

 cout<<"Enter side: "<<"\n";

 cin>>side;

 P_Square = 4*side;

 cout<<"The perimeter of the square is: "<<P_Square<<"\n";

 

 case 4:

 cout<<"Enter the length of first side: "<<"\n";

 cin>>a;

 cout<<"Enter the length of second side: "<<"\n";

 cin>>b;

 cout<<"Enter the length of third side: "<<"\n";

 cin>>c;

 

 P_Triangle = a+b+c;

 cout<<"The area of the triangle is: "<<P_Triangle<<"\n";

 

 default:

 cout<<"out of options";

 break;

}

break;

 

default:

cout<<"out of options";

break;

 

 

}

 

return 0;

 

}

Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education