-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclass53practice.cpp
58 lines (53 loc) · 1010 Bytes
/
class53practice.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
47
48
49
50
51
52
53
54
55
56
57
58
// #include<iostream>
// using namespace std; //area of circle using class using the variables in main()
// class circle
// {
// private:
// int r;
// float a=0;
// public:
// void putdata(int j)
// {
// r=j;
// }
// float area()
// {
// a=(float)3.14*r*r;
// return(a);
// }
// };
// int main()
// {
// int r,a;
// cout<<"ENTER THE RADIUS OF CIRCLE:";
// cin>>r;
// circle f;
// f.putdata(r);
// cout<<"THE AREA OF CIRCLE IS : "<<f.area();
// return 0;
// }
#include<iostream> //area of circle without using variables from main()
#include<math.h>
using namespace std;
class circle
{
float r,area;
public:
void putdata()
{
cout<<"ENTER THE AREA OF CIRCLE :";
cin>>r;
}
void getdata()
{
area=(float)3.14*r*r;
cout<<"THE AREA OF CIRCLE IS : "<<area<<endl;
}
};
int main()
{
circle f;
f.putdata();
f.getdata();
return 0;
}