bsc

Comprehensive codebase and cou...
Log | Files | Refs | Activity | README | LICENSE

root / semester_2 / practice / prac_002.cpp

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 }
© notamitgamer • Site Built: 2026-09-05 01:53:16 UTC • git-mirror commit: c170d72 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror