/** Program Copyright and version description Section * copyright (c) 2013, a student from the computer College of Yantai University. * All rightsreserved. * Prepared by: Liu Mingliang * completed on: July 15, May 10, 2013 * version: V1.0 * input Description: * Problem description: * output: */# include <iostream> # include <cmath> using namespace STD; Class Point // defines the coordinate class {public: Point (): x (0), y (0) {}; point (double x0, double y0): X (x0), y (y0) {}; void printpoint (); // information of the output vertex Double X, Y; // data member, indicating the horizontal and vertical coordinates of the vertex}; void point: printpoint () {cout <"Point :(" <x <", "<Y <") \ n "; // output point} class line: Public point // use the coordinate point class to define the line class, the data member of its base class indicates the midpoint of the straight line {public: Line (point pts, point PTE); // constructor, use the two endpoints of the initialized line and the midpoint double length () described by the base class data members; // calculate and return the length of the Line void printline (); // two endpoints of the output line and the line length PRIVATE: Class Point pts, PTE; // two endpoints of the line}; // The line class member function line is defined below :: line (point pt1, point pt2): Point (pt1.x + pt2.x)/2, (pt1.y + pt2.y)/2) {PTS = pt1; PTE = pt2;} double line:: length () {return SQRT (PTS. x-pte.x) * (PTS. x-pte.x + (PTS. y-pte.y) * (PTS. y-pte.y);} void line: printline () {PTS. printpoint (); Pte. printpoint (); cout <"length is:" <length () <Endl;} int main () {point PS (-), PE ); line L (Ps, PE); L. printline (); // output line l Information (Please completeCode ) Cout <"the middle point of line:"; L. printpoint (); // output the information of the point in the line L (please complete the Code) return 0 ;}