-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshapes.cpp
More file actions
47 lines (47 loc) · 1.05 KB
/
shapes.cpp
File metadata and controls
47 lines (47 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include<iostream>
#include<conio.h>
using namespace std;
int main(){
int id=0;
float area=0,circum=0,a,l,w,r;
cout<<"Enter shapeId : "<<endl;
cin>>id;
switch(id){
case 1:
cout<<"You have chosen square please enter the length of its side:"<<endl;
cout<<"Enter the side of the square(S): ";
cin>>a;
area = a*a;
if(area<500){
cout<<"Area of Sqaure : "<<area<<endl;
}
else{
cout<<"The area excited limit of 500"<<endl;
}
break;
case 2:
cout<<"You have chosen rectangle please enter the width and height:"<<endl;
cout<<"Enter width of rectangle : ";
cin>>w;
cout<<"Enter length of rectangle : ";
cin>>l;
area = w*l;
cout<<"Area of Rectangle : "<<area<<endl;
break;
case 3:
cout<<"You have chosen circle please enter the radius of circle:"<<endl;
cout<<"Enter the radius: ";
cin>>r;
area = 3.14*r*r;
circum= 2*3.14*r;
if(area>circum){
cout<<"Area of Circle : "<<area<<endl;
}
else{
cout<<"Circumference of Circle is "<<circum<<endl;
}
break;
default:
exit(0);
}
}