A CLASS CIRCLE STORES AS A DATA MEMBER THE RADIUS AND AREA OF CIRCLE AND TWO CONSTRUCTOR FUNCTIONS. THE FIRST ACCEPTS ARGUMENT AS TH RADIUS AND CALCULATE ITS AREA. THE SECOND IS A COPY CONSTRUCTOR THAT INCREASES THE AREA OF CIRCLE BY 1 AND CALCULATE ITS AREA. ALSO, INCLUDE ANOTHER MEMBER FUNCTION TO DISPLAY RADIUS AND AREA OF THE CIRCLE.
#include<iostream.h>
#include<conio.h>
class
circle
{
float area,radius;
public:
circle(float rad)
{
radius=rad;
area=3.14*radius*radius;
}
circle(circle & c)
{
radius=c.radius;
area=c.area;
}
void display ()
{
cout<<”Radius:”<<radius;
cout<<”Area:”<<area;
}
};
void main()
{
clrscr();
circle ob(4.0);
circle ob1(ob);
ob.display();
getch();
}
I was searching an excellent blog in this topic, thanks admin for the info on latest technology.
ReplyDeletecloud computing training in chennai
Hadoop Training in Chennai
Selenium Training in Chennai
Digital Marketing Course in Chennai
JAVA Training in Chennai
German Classes in chennai
German Classes in T Nagar