两点距离公式 (x1-x2)^2 + (y1-y2)^2 再开根。float point::distance(const point& pt){ return sqrt((this.x-pt.x)*(this.x-pt.x) + (this.y-pt.y)*(this.y-pt.y)) ;}//sqrt 求平方根。this应该用 -> 也就是 this->x 。笔误。