/** char again = 'y';
while ( again == 'y')**/
switch(x)
{
case 1:
int c;
cout << "CALCULATE VOLUME OF THE FOLLOWING SHAPES" << endl;
cout <<"\nVolume"<<endl;
cout <<"select a shape"<<endl;
cout <<"\n1.Sphere\n 2.Cone\n 3.Pyramid"<<endl;
cin >>c;
switch (c)
{
case 1:
float r,b;
cout << "CALCULATE VOLUME OF THE SPHERE" << endl;
cout <<"Sphere"<<endl;
cout <<"Enter radius"<<endl;
cin >>r; // r = radius
b=(((4/3)*(PI))*pow(r,3));
cout <<"The volume is = "<<b<<endl;
break;
case 2:
float a,d,e;
cout << "CALCULATE VOLUME OF A CONE\n" << endl;
cout <<"Cone"<<endl;
cout <<"Enter radius"<<endl;
cin >>a; //r= radius
cout <<"Enter height"<<endl;
cin >>d; //d= height
e=((PI*pow(c,2))*(d/3));
cout <<"The volume is = "<<e<<endl;
break;
case 3:
float f,g,h,i;
cout << "CALCULATE VOLUME OF A PYRAMID" << endl;
cout <<"Pyramid"<<endl;
cout <<"Enter length"<<endl;
cin >>f; // f= length of the pyramid
cout <<"Enter width"<<endl;
cin >>g; //g= width of the pyramid
cout <<"Enter height"<<endl;
cin >>h; //h= height of the pyramid
i=((f*g*h)/3);
cout <<"The volume is = "<<i<<endl;
break;
}
break;
case 2:
int f;
cout << "CALCULATE AREA OF THE FOLLOWING SHAPES" << endl;
cout <<"\nArea"<<endl;
cout <<"SELECT SHAPE\n"<<endl;
cout <<"\n1.Parallelogram\n2.Triangle\n3.Trapezoid\n4.Circle\n5.Ellipse\n6.Sphere\n7.Cylinder"<<endl;
cin >>f;
switch (f)
{
case 1:
int a,b,c;
cout << "CALCULATE AREA OF A PARALLELOGRAM" << endl;
cout <<"Parallelogram"<<endl;
cout <<"Enter the height"<<endl;
cin >>a; // a= the height of a parallelogram
cout <<"Enter the width"<<endl;
cin >>b; // b= width of a parallelogram
c=a*b;
cout <<"The area is = "<<c<<endl;
break;
case 2:
int d,e,f;
cout << "CALCULATE AREA OF A TRIANGLE" << endl;
cout <<"Triangle"<<endl;
cout <<"\nEnter the height"<<endl;
cin >>d; // d= the height of a triangle
cout <<"Enter the width"<<endl;
cin >>e; // e= the width of a triangle
f=0.5*(e*d);
cout <<"The area is = "<<f<<endl;
break;
case 3:
int g,h,i,j;
cout << "CALCULATE AREA OF A TRAPEZOID" << endl;
cout <<"Trapezoid"<<endl;
cout <<"\nEnter first length"<<endl;
cin >>g; //f= the first length of a trapezoid
cout <<"Enter second length"<<endl;
cin >>h; // h= the second length of a trapezoid
cout <<"Enter the height"<<endl;
cin >>i; // i= the height of a trapezoid
j=((h+g)/2)*i;
cout <<"The area is = "<<j<<endl;
break;
case 4:
float k,l;
cout << "CALCULATE AREA OFA CIRCLE" << endl;
cout <<"Circle"<<endl;
cout <<"\nEnter the radius"<<endl;
cin >>k; // k= radius of a circle
l=PI*pow(k,2);
cout <<"The area is = "<<l<<endl;
break;
case 5:
float m,n,o;
cout <<"Ellipse"<<endl;
cout <<"\nEnter the height"<<endl;
cin >>m;
cout <<"Enter the width"<<endl;
cin >>n;
o=PI*m*n;
cout<<"The area is = "<<o<<endl;
break;
case 6:
float p,q;
cout << "CALCULATE SURFACE AREA OF A SPHERE" << endl;
cout <<"Sphere"<<endl;
cout <<"\nEnter the radius"<<endl;
cin >>p; // p= radius of a sphere
q=4*PI*pow(p,2);
cout <<"The surface area is = "<<q<<endl;
break;
case 7:
float r,s,t;
cout << "CALCULATE SURFACE AREA OF A CYLINDER" << endl;
cout <<"Cylinder"<<endl;
cout <<"\nEnter radius"<<endl;
cin >>r; //r= radius of a cylinder
cout <<"Enter height"<<endl;
cin >>s; // s= height of a cylinder
t=(2*PI*r*s)+(2*PI*pow(r,2));
cout <<"the whole surface area is = "<<t<<endl;
break;
}
break;
case 3:
int d;
cout << "CALCULATE PERIMETER OF LISTED SHAPES" << endl;
case 1:
int length,width,perimeter;
cout << "CALCULATE PERIMETER OF A RECTANGLE" << endl;
cout <<"Rectangle"<<endl;
cout <<"\nEnter Length"<<endl;
cin >>length;
cout <<"Enter width"<<endl;
cin >>width;
perimeter=2*(length+width);
cout <<"The perimeter is = "<<perimeter<<endl;
break;
case 2:
int a,b,c;
cout << "CALCULATE PERIMETER OF A PARALLELOGRAM" << endl;
cout <<"Parallelogram"<<endl;
cout <<"\nEnter Length"<<endl;
cin >>a; // a= the length of a parallelogram
cout <<"Enter width"<<endl;
cin >>b; // b= the width of a parallelogram
c=2*(a+b);
cout <<"The perimeter is = "<<c<<endl;
break;
case 3:
int l1,l2,w1,w2,d;
cout << "CALCULATE PERIMETER OF A TRAPEZOID" << endl;
cout<<"Trapezoid"<<endl;
cout<<"\nEnter Length1"<<endl;
cin>>l1; //l1= the first length of the trapezoid
cout<<"\nEnter Length2"<<endl;
cin>>l2; // l2= the second length of the trapezoid
cout <<"Enter width1"<<endl;
cin >>w1; // w1= the first width of the trapezoid
cout <<"Enter width2"<<endl;
cin >>w2; // w2= second width of the trapezoid