CodePudding user response:
Your code?CodePudding user response:
No code, no truth,CodePudding user response:
#includeCodePudding user response:
Reference:# include
#include
# define PI 3.141592
using namespace std;
The class Point {
Private: double x, y;
Public: Point (double x_=0, double y_=0) : x (x_), y (y_) {};//, y (y_)
Double GetX () const;
Double GetY () const;
Void Change (int a, int b);
Void the print ();
Void the print () const;
Friend a double Area (const Point& , Point&);
};
Const double Point: : GetX ()
{
Return the x;
}
Const double Point: : GetY ()
{
The return of y;
}
The void Point: : Change (int a, int b)
{
//double x0, y0;
//cin> X0 & gt;> Y0.
//x=x0;
//y=y0;
X=a;
Y=b;
}
The void Point: : print ()
{
Cout<& lt;" ("}
The void Point: : print () const
{
Cout<& lt;" ("}
Double Area (const Point & amp; P1, Point & amp; P2)
{
Double r;
R=SQRT ((p1) X-ray p2) x) * (p1) X-ray p2) x) + (p1) y - p2) y) * (p1) y - p2) y));
return PI*r*r;
//cout}
Int main ()
{
Const Point p1.
P1. The print ();
Point p2 (5, 3);
P2. Print ();
Cout<& lt;" S1="& lt;
P2. Change (56, 34);
P2. Print ();
Cout<& lt;" S1="& lt;
return 0;
}
//(0, 0)
///(5, 3)
//s1=106.814
//(56, 34)
//s1=13483.7
//please press any key to continue...