Home > Back-end >  C questions
C questions

Time:03-30

Define a Point class, including:
Two private data: _x _y, are of type double, store coordinates;
A constructor that Point (double x0=0, double y0=0).
Four member function:
Void moveto (double x0, double y0); The coordinates of points into (x0, y0)
Double x (); Get the x coordinate values
Double y (); Get y coordinate values
Double disToO (); Computing
the distance to the origin
At the same time, according to the following requirements. Write the main function:
First type n (n<1000), and then input n Point x, y coordinates to Point array of objects, and to sort these points (according to the distance to the origin) since the childhood, and then sorted output Point (coordinates),
Will be ordered () after all points x, y coordinates each plus 1, then output the coordinates of all points again,
  • Related