So I Wrote A Program That goes like this:
1.Area (Takes User Input if he wants to calculate are
2.Perimeter or perimter)
And Then Displays Figure Options such as square,circle etc and takes their respective measurements and shows the output but problem is only Perimeter option is working.
The Area (1) input takes 1,also displays figures,also displays the taking input statements but at final part that is calculations it randomy shows the perimeter menu? I don't know why this is happening,maybe brackets?
#include<iostream>
#include<stdlib.h>
usingnamespace std;
int main()
{
float rl,rb,sl,trh,trb,cr;
int choice1,choicea,choicep;
cout<<"\n1.Area\n2.Perimeter";
cin>>choice1;
switch(choice1)
{
case 1 : system("cls");
cout<<"\n1.Square\n2.Rectangle\n3.Circle\n4.Triangle";
cin>>choicea;
switch(choicea)
{
case 1 : cout<<"\nEnter The Length Of Square :";
cin>>sl;
cout<<"The Area Of Square = "<< sl * 4;
break;
case 2 : cout<<"\nEnter The Length and Breadth Of Rectangle :";
cin>>rl>>rb;
cout<<"\nThe Area Of Rectangle = "<<rl * rb;
break;
case 3 : cout<<"\nEnter The Radius Of Circle :";
cin>>cr;
cout<<"\nThe Area Of Circle = "<< 3.14 * cr * cr;
break;
case 4 : cout<<"\nEnter Base And Height Of Triangle :";
cin>>trh>>trb;
cout<<"\nThe Area of Triangle = "<< 0.5 * trb * trh;
break;
default : cout<<"\nWrong CHOICE!!!!!!!!";
break;
}
case 2 : system("cls");
cout<<"\n1.Circle\n2.Square\n3.Rectangle";
cin>>choicep;
switch(choicep)
{
case 1 : cout<<"\nEnter The Radius Of The Circle :";
cin>>cr;
cout<<"\nThe Perimeter Of Circle = "<<2 * 3.14 * cr;
break;
case 2 : cout<<"\nEnter The Length Of Square :";
cin>>sl;
cout<<"\nThe Perimeter Of Square = "<< 4 * sl;
break;
case 3 : cout<<"\nEnter The Length and Breadth Of Rectangle ";
cin>>rl>>rb;
cout<<"\nThe Perimeter Of Rectangle is = "<<2*(rb + rl);
break;
default : cout<<"\nWrong CHOICEEEE!!!!!!!!!";
break;
}
}
return 0;
}