prac_002.cpp (559B)
1 /* design a class circle.take radius as input, calculate the area */ 2 3 #include <iostream> 4 using namespace std; 5 6 class circle { 7 int radius, area; 8 9 public: 10 int input(); 11 int calculation(); 12 int output(); 13 }; 14 15 int circle::input() { 16 cout << "\nEnter the radius of the circle : "; 17 cin >> radius; 18 } 19 20 int circle::calculation() { 21 area = 3.14159 * radius * radius; 22 } 23 24 int circle::output() { 25 cout << "\nThe area of the circle is : " << area; 26 } 27 28 int main() { 29 circle z; 30 z.input(); 31 z.calculation(); 32 z.output(); 33 return 0; 34 }