Print Friendly and PDF
#include<iostream>
using namespace std;

class Circle

{

private:

double radius;

public:

void setradius( double R )

{

radius = R;

}

double getradius() const

{

return radius;

}

double getArea() const

{

return 3.14*radius*radius;

}

};

int main()

{

Circle C;

double cradius;

cout<<"Enter the radius of the circle:";

cin>>cradius;

C.setradius(cradius);

cout<<"Here is the circle's data:"<<endl;

cout<<"radius : "<<C.getradius()<<endl;

cout<<"Area : "<<C.getArea()<<endl;

system("pause");

}
zubairsaif

Zubair saif

A passionate writer who loves to write on new technology and programming

Post A Comment:

0 comments: