0% found this document useful (0 votes)
5 views2 pages

Practical 13-cs1

The document outlines the implementation of a Circle class in C++, which includes attributes for radius and coordinates, along with methods for calculating area and circumference. It features a default constructor, input functions, and a display function to print the circle's properties. The program demonstrates the usage of the Circle class by creating an object, retrieving user input for the radius, and displaying the calculated values.

Uploaded by

nerdyabhi96
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Practical 13-cs1

The document outlines the implementation of a Circle class in C++, which includes attributes for radius and coordinates, along with methods for calculating area and circumference. It features a default constructor, input functions, and a display function to print the circle's properties. The program demonstrates the usage of the Circle class by creating an object, retrieving user input for the radius, and displaying the calculated values.

Uploaded by

nerdyabhi96
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Implement a Circle class in C++.

Each object of this class will represent a circle, storing its radius and x
and y co-ordinates of its Centre as floats. Include a default constructor , access functions ,an area()
function and circumference() function. The program must print the co-ordinates with radius , area
and circumference of the circle.

include<iostream.h>

include<conio.h>

class circle

private:

float radius;

int x,y;

float area, peri;

public:

circle();

void getradius();

void area();

void circumference();

};

circle::circle()

x=1;

y=1;

circle::void getradius()

cout<<”Enter radius:”;

cin>>radius;

circle::void area()

area=3.14*radius*radius;

}
circle::void circumference()

peri = 2*3.142*radius;

circle::void display()

cout<<” Co-ordinates of circle are: “<<x ”\t”<<y<<endl;

cout<<”Radius of circle: “<<radius<<endl;

cout<<”Area of circle: “<<area<<endl;

cout<<”Circumference of circle : “<<peri<<endl;

void main()

clrscr();

circle c;

c.getradius();

c.area();

c.circumference();

c.display();

getch();

You might also like