-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharea.cpp
More file actions
55 lines (48 loc) · 808 Bytes
/
area.cpp
File metadata and controls
55 lines (48 loc) · 808 Bytes
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
48
49
50
51
52
53
54
55
#include<iostream>
#include<cmath>
using namespace std;
void menu();
void circle(){
float pi=3.14,r;
cout<<"enter radius:";
cin>>r;
cout<<"area of circle:"<<pi*r*r<<"\n";
menu();
}
void rec(){
float l,b;
cout<<"enter lenght and breadth:";
cin>>l>>b;
cout<<"area of rectangle:"<<l*b<<"\n";
menu();
}
void square(){
float s;
cout<<"enter side of sqaure:";
cin>>s;
cout<<"area of square:"<<s*s<<"\n";
menu();
}
void quit(){
exit(0);
}
void menu(){
int n;
cout<<"choose an option\n 1.area of circle \n 2.area of rectangle \n 3.area of square \n 4.exit program \n" ;
cin>>n;
switch(n){
case 1:circle();
break;
case 2:rec();
break;
case 3:square();
break;
case 4:quit();
break;
default:break;
}
}
int main(){
menu();
return 0;
}