Using a switch statement, write a menu-driven program to find the area and perimeter of a square or rectangle. For finding the area and perimeter of the square input the length of the side and for finding the area and perimeter of the rectangle input the length and breadth of the rectangle.
Please need an answer fast, please.
Answers
Answered by
3
Answer:
The answer is given in the image.
Pls mark brainliest.
Attachments:
Answered by
2
Answer:#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int l,b,a,p,opt;
cout <<"menu"<<endl;
cout<<"area of rectangle"<<endl;
cout<<"perimeterof rectangle" <<endl;
cin>>opt;
switch (opt)
{
case 1 : cout<<"enter the length and breath"<<endl;
a=l*b;
cout<<"area="<<a;
break;
case 2 : cout<<"enter the length and breath"<<endl;
p=2*(l+b);
cout<<"perimeter="<<p;
break;
default :cout<<"invalid input";
}
getch();
}
Explanation:
Similar questions