c++空间点的距离程序。最后distance函数要两点坐标之差,该怎么设计

2025-06-22 02:56:14
推荐回答(3个)
回答1:

算距离这个函数定义不对,还需要要另一个点的数据才可以

int Point::distance(Point &other)
{

int iDis = sqrt( pow((other.a - this->a), 2) + pow(other.b-this->b, 2) );

iDis = sqrt( iDis + pow(other.c-this->c, 2) );

}

回答2:

查书去

回答3:

distance函数要求是成员函数么?