menu search
brightness_auto
more_vert
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_off_alt 0 like thumb_down_off_alt 0 dislike

1 Answer

more_vert
 
verified
Best answer

#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_off_alt 0 like thumb_down_off_alt 0 dislike

Related questions

thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike
1 answer
thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike
1 answer
thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike
1 answer
thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike
0 answers

Subscribe to our Youtube Channel

For amazing tutorial videos, podcasts, hindi tutorials

thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike
1 answer
thumb_up_off_alt 0 like thumb_down_off_alt 0 dislike
1 answer

4.1k questions

3.6k answers

50 comments

376 users

...