prac_002.cpp (695B)
1 /* 2 * Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 22 Jun 2026 3 * Repo: https://github.com/notamitgamer/bsc 4 * License: MIT 5 */ 6 7 /* design a class circle.take radius as input, calculate the area */ 8 9 #include <iostream> 10 using namespace std; 11 12 class circle { 13 int radius, area; 14 15 public: 16 int input(); 17 int calculation(); 18 int output(); 19 }; 20 21 int circle::input() { 22 cout << "\nEnter the radius of the circle : "; 23 cin >> radius; 24 } 25 26 int circle::calculation() { 27 area = 3.14159 * radius * radius; 28 } 29 30 int circle::output() { 31 cout << "\nThe area of the circle is : " << area; 32 } 33 34 int main() { 35 circle z; 36 z.input(); 37 z.calculation(); 38 z.output(); 39 return 0; 40 }