# Include <iostream>
# Include <math. h>
Using namespace STD;
Constdoublepi= 3.141593;
Classcircle;
// Classcalculate
//{
// Public:
// Doubledistance (circle & P1, circle & p2 );
//};
Classcircle
{
PRIVATE:
Doublex, Y, R;
Public:
// Constructor
Circle (double xx = 0, double YY = 0, double RR = 0)
{
X = xx; y = YY; r = RR;
}
// Display
Voiddisplay ()
{
Cout <"\ tcenter point: (" <x <"," <Y <")" <Endl;
Cout <"\ tradius:" <r <Endl;
Cout <"\ Tarea:" <this-> area () <Endl;
Cout <"\ tcirculars:" <this-> circular () <Endl;
}
// Area
Doublearea ()
{
Returnpi * r * R;
}
// Perimeter
Doublecircular ()
{
Return 2 * pI * R;
}
// Normal friend Functions
Frienddoubledist (circle & P1, circle & p2 );
// Member functions
// Frienddoublecalculate: distance (circle & P1, circle & p2 );
};
// If you forget this semicolon, an error is returned:
// 'Circle' followed by a double is illegal. (Did you forgot ';'?)
// Doublecalculate: distance (circle & P1, circle & p2)
//{
// Returnsqrt (p1.x-p2.x) * (p1.x-p2.x) + (p1.y-p2.y) * (p1.y-p2.y ));
//}
Doubledist (circle & P1, circle & p2)
{
Returnsqrt (p1.x-p2.x) * (p1.x-p2.x) + (p1.y-p2.y) * (p1.y-p2.y ));
}
Void main ()
{
Circle C1 (1, 1, 1), C2 (3, 4, 5 );
// Calculatecal; // a calculate object must be declared.
Cout <"circle 1:" <Endl;
C1.display ();
Cout <Endl;
Cout <"circle 2:" <Endl;
C2.display ();
// Cout <"The distance is:" <Cal. Distance (C1, C2) <Endl;
Cout <"The distance is:" <dist (C1, C2) <Endl;
}