用C/C++定义一个点类Point/

来源:百度知道 编辑:UC知道 时间:2024/06/02 11:19:34
1.用构造函数初始化类Point的对象?
2.定义函数Distance,计算平面上两点间的距离?
请高手们指点一下.我会好感谢高手们的.

/***************************************************************\
* Copyright (c) 2009 eryar All rights reserved. *
* *
* File : Main.CPP *
* Date : 2009-01-19 19:00 *
* Author : eryar@163.com *
* *
* Description: *
* 编写一个程序,设计一个点类Point,求两个点之间的距离。 *
\***************************************************************/

#include <cmath>
#include <iostream>
using namespace std;

class Point{
public:
Point(double _x = 0, double _y = 0) : x(_x), y(_y) { cout<<"[class Point default constructor]"<<endl; }
void ShowPoint() const { cout<<"