#include <iostream>
using namespace std;
void circle ();
void rectangle();
void triangle();
void sphere();
void cone();
void cylinder();
int main()
{ int cho1,cho2,cho3;
menu:
cout<<"1. Plane Figures\n"
<<"2. 3D Figures\n"
<<"3. Exit\n"
<<"Enter your Choice:";
cin>>cho1;
switch (cho1)
{ case 1:
cout<<"You selected Plane Figures\n"
<<"1. Circle\n"
<<"2. Rectangle\n"
<<"3. Triangle\n"
<<"Enter your Choice:";
cin>>cho2;
switch (cho2)
{ case 1:
cout<<"You selected Circle\n";
circle();
break;
case 2:
cout<<"You selected Rectangle\n";
rectangle();
break;
case 3:
cout<<"You selected Triangle\n";
triangle();
break;
default:
cout<<"Invalid Input!!!\n";
goto menu; /*At start of Main function*/
}
break;
case 2:
cout<<"You selected 3D figures\n"
<<"1. Cone\n"
<<"2. Cylinder\n"
<<"3. Sphere\n"
<<"Enter your choice:";
cin>>cho3;
switch (cho3)
{ case 1:
cout<<"You selected Cone\n";
cone();
break;
case 2:
cout<<"You selected Cylinder\n";
cylinder();
break;
case 3:
cout<<"You selected Sphere\n";
sphere();
break;
default:
cout<<"Invalid Input!!!";
goto menu; /*At start of Main function*/
}
break;
case 3:
goto menu; /*At start of Main function*/
break;
default:
cout<<"Invalid Input!!!";
goto menu; /*At start of Main function*/
}
}
void circle()
{ float r,a;
cout<<"Enter Radius:\n";
cin.get();
cin>>r;
a=22.0*r*r/7.0;
cout<<"Area is "<<a;
cin.get();
}
void rectangle()
{ float l,b,a;
cout<<"Enter Length and breadth:\n";
cin.get();
cin>>l>>b;
a=l*b;
cout<<"Area is "<<a;
cin.get();
}
void triangle()
{ float h,b,a;
cout<<"Enter Height and base:\n";
cin.get();
cin>>h>>b;
a=h*b/2.0;
cout<<"Area is "<<a;
cin.get();
}
void cone()
{ float r,h,a;
cout<<"Enter radius and height:\n";
cin.get();
cin>>r>>h;
a=22.0*r*r*h/21.0;
cout<<"Volume is "<<a;
cin.get();
}
void cylinder()
{ float r,h,a;
cout<<"Enter radius and height:\n";
cin.get();
cin>>r>>h;
a=22.0*r*r*h/7.0;
cout<<"Volume is "<<a;
cin.get();
}
void sphere()
{ float r,a;
cout<<"Enter radius:\n";
cin.get();
cin>>r;
a=88.0*r*r/21.0;
cout<<"Volume is "<<a;
cin.get();
}