Write a program that prompts the user to input the shape type such as circle,
rectangle, and rectangular prism and the appropriate dimension of the shape. The
program then outputs the following information about the shape: For a circle, it outputs
the area and circumference; for rectangle, outputs the perimeter and area, and for a
rectangular prism, outputs the volume and surface area.
#include<iostream>
using namespace std;
int main(){
int choice;
do {
cout<<"Select an option\n 1. Get the area and the perimeter of a circle\n";
cout<<"2. Get the area and the perimeter of a rectangular\n3. Get the volume and the surface area of a rectangular prism\n";
cout<<"0. To exit the program\n";
cin>>choice;
switch(choice){
case 1: cout<<"Enter the radius of the circle\n";
int rad;
cin>>rad;
cout<<"The area of the circle is: "<< 3.142 * rad * rad<<endl;
cout<<"The perimeter of the circle is: "<< 2 * 3.142 * rad<<endl;
break;
case 2: cout<<"Enter length of the rectangle\n";
int l;
cin>>l;
cout<<"Enter width of the rectangle\n";
int w;
cin>>w;
cout<<"The area of rectangle is: "<<l * w <<endl;
cout<<"The perimeter of rectangle is: "<<2 * (l + w)<<endl;
break;
case 3:
cout<<"Enter the length of the rectangular prism\n";
int le; cin>>le;
cout<<"Enter the width of the rectangular prism\n";
int wi;
cin>>wi;
cout<<"Enter the height of the rectangular prism\n";
int h;
cin>>h;
cout<<"The surface area of the rectangular prism: "<<2* (le * wi + wi * h + wi* h)<<endl;
cout<<"The volume of the rectangular prism: "<< le * wi *h<<endl;
break;
}
} while(choice != 0);
cout<<"Terminated\n";
}