-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRectangle.cpp
More file actions
58 lines (49 loc) · 1.18 KB
/
Rectangle.cpp
File metadata and controls
58 lines (49 loc) · 1.18 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
48
49
50
51
52
53
54
55
56
57
58
#include <iostream>
using namespace std;
class rectangle
{
private:
double l,b;
public:
void getdata()
{
cout<<endl<<"Enter the length and breadth"<<endl;
cout<<"ENTER THE LENGTH : "<<"\t";
cin>>l;
cout<<"ENTER THE BREADTH : "<<"\t";
cin>>b;
}
void display()
{
cout<<l<<endl<<b;
}
double area()
{
double temp;
temp=l*b;
return temp;
}
double perimeter()
{
double temp;
temp=2*(l+b);
return temp;
}
};
int main()
{
rectangle a1;
double area,perimeter;
cout<<"WELCOME TO AREA & PERIMETER CALCULATOR"<<endl;
cout<<"*********************************************";
a1.getdata();
area=a1.area();
perimeter=a1.perimeter();
cout<<"**********************************************"<<endl;
cout<<"THE AREA IS : "<<area<<endl;
cout<<"**********************************************"<<endl;
cout<<"THE PERIMETER IS : "<<perimeter<<endl;
cout<<"**********************************************"<<endl;
cout<<"THANK YOU"<<endl;
return 0;
}