-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclass36.cpp
46 lines (41 loc) · 822 Bytes
/
class36.cpp
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
#include<iostream> // Q61 to find area of circle which have different radius, with the use of operator iverloading fine which cricle's area greater
using namespace std;
#define PI 3.14
class circle
{
int radius;
public:
circle(int r)
{
radius=r;
}
float area()
{
return PI*radius*radius;
}
int operator>(circle t)
{
if(radius>t.radius)
{
return 1;
}
else{
return 0;
}
}
};
int main()
{
circle c1(10),c2(20);
cout<<"Area of Circle C1 : ";
cout<<c1.area()<<endl;
cout<<"Area of Circle C2 : ";
cout<<c2.area()<<endl;
if(c1>c2)
{
cout<<"Area of cirlce C1 us Greater than C2";
}
else
cout<<"Area of Circle C2 is Greater than C1";
return 0;
}