The following code :
=================================
#include<iostream.h>
class circle{
private:
int X,Y;
float R;
public:
void input();
void output();
float Area();
float Perimeter();
};
void circle::input(){
cout<<"X:";cin>>X;
cout<<"Y:";cin>>Y;
cout<<"radius:";cin>>R;
}
void circle::output(){
cout<<X<<"\t"<<Y<<"\t"<<R<<"\t"<<Area()<<"\t"<<Perimeter()<<endl;
}
float circle::Area(){
return R*R*3.14;
}
float circle::Perimeter(){
return 2*R*3.14;
}
void main()
{
circle c1,c2,c3, max;
cout<<"Input Data of C1:"<<endl;
c1.input();
cout<<"Input Data of C2:"<<endl;
c2.input();
cout<<"Input Data of C3:"<<endl;
c3.input();
max=c1;
if(max.Area()<c2.Area()) max=c2;
if(max.Area()<c3.Area()) max=c3;
max.output();
cout<<"data of 3 Circle:"<<endl;
cout<<"X\ty\tRadius\tArea\tPerimeter"<<endl;
c1.output();
c2.output();
c3.output();
}
0 comments:
Post a Comment