-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathPROGRAM 1.cpp
More file actions
53 lines (51 loc) · 944 Bytes
/
PROGRAM 1.cpp
File metadata and controls
53 lines (51 loc) · 944 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
#include <iostream>
using namespace std;
class shape
{
float radius;
float width;
float length;
public:
shape()
{
radius=0.0;
width=0.0;
length=0.0;
}
shape(float r)
{
radius=r;
}
shape(float w,float l)
{
width=w;
length=l;
}
void circle_perimeter()
{
float perimeter;
perimeter=2*3.14*radius;
cout<<"perimeter of circle is "<<perimeter<<endl;;
}
void rectangle_perimeter()
{
float perimeter;
perimeter=2*(length+width);
cout<<"perimeter of rectangle is "<<perimeter<<endl;
}
~shape()
{
}
};
int main()
{
float r,w,l;
cout<<"enter radius of circle \n";
cin>>r;
cout<<"enter width and length of rectangle \n";
cin>>w>>l;
shape circle(r);
shape rectangle(w,l);
circle.circle_perimeter();
rectangle.rectangle_perimeter();
}