This project has moved and is read-only. For the latest updates, please go here.

Create a class circle, that have the one data member radius; and have a methods SetRadius that set the value of the radius and another method that compute the area of circle; then in your main program access the method and display the area of the circle.

Nov 27, 2015 at 3:26 PM

class Circle
    float radius;
    void setRadius(float value)
        radius = value;
    float areaOfCircle()
        return 3.14 * pow(radius,2);

void main()
    Circle circle;
    float radius, area;
    cout<<"Enter the radius of a circle\n";
    area = circle.areaOfCircle();
    cout<<"Area of a circle = "<<area;