point(float a,float b):x(a,b){};
答案:2 悬赏:20 手机版
解决时间 2021-04-04 04:43
- 提问者网友:未信
- 2021-04-03 19:11
point(float a,float b):x(a,b){};
最佳答案
- 五星知识达人网友:人類模型
- 2021-04-03 20:29
#include
#include
class Point
{
private:
float x,y;
public:
Point(float a = 0.0f,float b = 0.0f):x(a),y(b){};
friend float dis(Point &left,Point& right);
};
float dis(Point &left,Point& right)
{
float a = pow(left.x-right.x,2);
float b = pow(left.y - right.y,2);
return sqrt(a + b);
//return sqrt(pow((left.x-right.x),2) + pow(left.y - right.y,2));
}
int main()
{
Point pox(2.0,3.0);
Point poy(3.0,3.0);
float result = dis(pox,poy);
cout<
return 0;
}
#include
class Point
{
private:
float x,y;
public:
Point(float a = 0.0f,float b = 0.0f):x(a),y(b){};
friend float dis(Point &left,Point& right);
};
float dis(Point &left,Point& right)
{
float a = pow(left.x-right.x,2);
float b = pow(left.y - right.y,2);
return sqrt(a + b);
//return sqrt(pow((left.x-right.x),2) + pow(left.y - right.y,2));
}
int main()
{
Point pox(2.0,3.0);
Point poy(3.0,3.0);
float result = dis(pox,poy);
cout<
return 0;
}
全部回答
- 1楼网友:罪歌
- 2021-04-03 21:07
我觉得这答案就是在扯,那是一个构造函数初始化列表
给你贴上运行正确的程序
#include
#include
class Point
{
private:
float x,y;
public:
Point(float a = 0.0f,float b = 0.0f):x(a),y(b){};
friend float dis(Point &left,Point& right);
};
float dis(Point &left,Point& right)
{
float a = pow(left.x-right.x,2);
float b = pow(left.y - right.y,2);
return sqrt(a + b);
//return sqrt(pow((left.x-right.x),2) + pow(left.y - right.y,2));
}
int main()
{
Point pox(2.0,3.0);
Point poy(3.0,3.0);
float result = dis(pox,poy);
cout< return 0;
}
给你贴上运行正确的程序
#include
#include
class Point
{
private:
float x,y;
public:
Point(float a = 0.0f,float b = 0.0f):x(a),y(b){};
friend float dis(Point &left,Point& right);
};
float dis(Point &left,Point& right)
{
float a = pow(left.x-right.x,2);
float b = pow(left.y - right.y,2);
return sqrt(a + b);
//return sqrt(pow((left.x-right.x),2) + pow(left.y - right.y,2));
}
int main()
{
Point pox(2.0,3.0);
Point poy(3.0,3.0);
float result = dis(pox,poy);
cout<
}
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯