#include<iostream>
#include<math.h>
using namespace std;
int main(){
int x;
do{
cout<<"Enter the shape type such as circle, rectangle, and rectangular prism\n";
string shape;
getline(cin, shape);
if(shape=="circle"){
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 area of the circle is: "<<2 * 3.142 * rad <<endl;
}
else if(shape== "rectangle"){
cout<<"Enter the width of the rectangle\n";
int wid;
cin>>wid;
cout<<"Enter the length of the rectangle\n";
int len;
cin>>len;
cout<<"The area of the rectangle is: "<<len * wid<<endl;
cout<<"The perimeter of the rectangle is: "<<2*(len + wid)<<endl;
}
else if(shape == "rectangular prism"){
int length, width, height;
cout<<"Enter the length of the rectangular prism:\n ";
cin>>length;
cout<<"Enter the width of the rectangular prism:\n ";
cin>>width;
cout<<"Enter the height of the rectangular prism:\n ";
cin>>height;
cout<<"The surface area of the rectangular prism: "<<2* (length * width + width* height + width * height)<<endl;
cout<<"The volume of the rectangular prism: "<< length * width *height<<endl;
}
cout<<"Enter 0 to terminate the program or 1 to continue\n";
cin>>x;
}while(x!=0);
cout<<"Terminated successfully\n";
}
Comments
Thank U Very much its big to me❤️
Leave a comment