-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patha circle.cpp
More file actions
56 lines (50 loc) · 896 Bytes
/
Copy patha circle.cpp
File metadata and controls
56 lines (50 loc) · 896 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
/* area and circumference of a circle program */
#include<iostream>
using namespace std;
#define pi 22/7//define constant pi 22/7
//class definition
class circle
{
//declare data members
private:
int radius,area,circumference;
//declare data fuctions
public:
int input();
int compute();
int output();
};
//define member fuctions
int circle::input()
{
cout<<"/n input the radius";
cin>>radius;
}
int circle::compute()
{
area=radius*radius*pi;
circumference=2*radius*pi;
}
int circle::output()
{
cout<<"/n area:"<<area;
cout<<"/n circumference:"<<circumference;
}
int main()
{
//create three objects
circle a,b,c;
//input for each
a.input ();
b.input ();
c.input();
//compute for each
a.compute ();
b.compute ();
c.compute();
//output for each
a.output();
b.output();
c.output();
return 0;
}