menu search
person
Write an Object Oriented Program in C++, to implement circle class to find area and circumference of a circle using functions void area(), void circum().
thumb_up_alt 0 like thumb_down_alt 0 dislike
3 views

1 Answer

 
verified

#include<iostream>

using namespace std;


class Circle 

{

public:

    float radius, area_of_circle,circumference;


    void getRadius() 

{

        cout << "Enter radius of a circle:";

        cin >> radius;

    }


    void area() 

{

        area_of_circle = 3.14 * radius * radius;

    }

    

    void circum()

    {

    circumference= 2 * 3.14 * radius;

}


void display() 

{

        cout << "Area of circle is:" << area_of_circle<<endl;

        cout << "Circumference of circle is:" << circumference;

    }

};


int main() {


    Circle cir;


    cir.getRadius();

    cir.area();

    cir.circum();

    cir.display();


    return 0;

}



Output::

thumb_up_alt 0 like thumb_down_alt 0 dislike
...