/* 02. * copyright and version Declaration of the program part 03. * copyright (c) 2012, Yantai University Computer college student 04. * All rightsreserved.05. * file name: object. cpp06. * Author: Liu ming07. * Completion Date: April 8, April 14, 2013. * version: v1.009. * input Description: 10. * Problem description: 11. * program output: */# include <iostream> # include <cmath> using namespace STD; Class cpoint {PRIVATE: Double X; // abscissa Double Y; // ordinate public: cpoint (double xx = 0, double YY = 0): X (XX), y (yy) {} double distance1 (cpoint &); friend double distance2 (cpoint &, cpoint &); double getx () {return X;} double Gety () {return y ;}}; double cpoint: distance1 (cpoint & P) {double dx = (x-p.x), Dy = y-p.y; return SQRT (dx * dx + dy * Dy);} double distance2 (cpoint & P1, cpoint & p2) {double dx = (p1.x-p2.x), Dy = p1.y-p2.y; return SQRT (dx * dx + dy * Dy);} double distane3 (cpoint & P1, cpoint & p2) {double dx = (p1.getx ()-p2.getx (), Dy = p1.gety ()-p2.gety (); Return SQRT (dx * dx + dy * Dy );} int main () {cpoint p1 (5, 6), P2 (2, 4); cout <"1. "<p1.distance1 (P2) <Endl; cout <" 2. "<distance2 (P1, P2) <Endl; cout <" 3. "<distan2010( p1, p2) <Endl; return 0 ;}