-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathscopeReso.cpp
More file actions
66 lines (65 loc) · 945 Bytes
/
scopeReso.cpp
File metadata and controls
66 lines (65 loc) · 945 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
56
57
58
59
60
61
62
63
64
65
66
#include<bits/stdc++.h>
using namespace std;
class Rectangle
{
private:
int length;
int breadth;
public:
Rectangle();
Rectangle(int l,int b);
Rectangle(Rectangle &r);
int getLength(){return length;}
int getBreadth(){return breadth;}
void setLength(int l);
void setBreadth(int b);
int area();
int perimeter();
bool isSquare();
~Rectangle();
};
int main()
{
Rectangle r1(10,10);
cout<<"Area "<<r1.area()<<endl;
if(r1.isSquare())
cout<<"Yes"<<endl;
}
Rectangle::Rectangle()
{
length=1;
breadth=1;
}
Rectangle::Rectangle(int l,int b)
{
length=l;
breadth=b;
}
Rectangle::Rectangle(Rectangle &r)
{
length=r.length;
breadth=r.breadth;
}
void Rectangle::setLength(int l)
{
length=l;
}
void Rectangle::setBreadth(int b)
{
breadth=b;
}
int Rectangle::area()
{
return length*breadth;
}
int Rectangle::perimeter()
{
return 2*(length+breadth);
}
bool Rectangle::isSquare()
{
return length==breadth;
}
Rectangle::~Rectangle(){
cout<<"Rectangle Destroyed";
}