我想知道我这个程序到底哪里出问题了!是使用对象作为函数参数计算两点之间的距离的问题的!
来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/09/22 10:29:11
我想知道我这个程序到底哪里出问题了!是使用对象作为函数参数计算两点之间的距离的问题的!
#include
#include
using namespace std;
class ZB
{
private:
int x;
int y;
double m;
public:
ZB(int a,int b)
{
x=a;
y=b;
}
int get_x()
{
return x;
}
int get_y()
{
return y;
}
void set(double n)
{
m=n;
}
};
void sqr(ZB j1,ZB j2)
{
j1.set(sqrt(j1.get_x()*j2.get_x()+j1.get_y()*j2.get_y()));
cout
#include
#include
using namespace std;
class ZB
{
private:
int x;
int y;
double m;
public:
ZB(int a,int b)
{
x=a;
y=b;
}
int get_x()
{
return x;
}
int get_y()
{
return y;
}
void set(double n)
{
m=n;
}
};
void sqr(ZB j1,ZB j2)
{
j1.set(sqrt(j1.get_x()*j2.get_x()+j1.get_y()*j2.get_y()));
cout
/* m 是ZB类的私有成员,不能在外部直接用对象访问,故增加了 get_m()方法.
计算两点间距离的公式应该也有问题,应该是 d = sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)) */
#include
#include
using namespace std;
class ZB
{
private:
int x;
int y;
double m;
public:
ZB(int a,int b)
{
x=a;
y=b;
}
int get_x()
{
return x;
}
int get_y()
{
return y;
}
double get_m()
{
return m;
}
void set(double n)
{
m=n;
}
};
void sqr(ZB j1,ZB j2)
{
j1.set(sqrt(pow(j1.get_x()-j2.get_x(),2)+pow(j1.get_y()-j2.get_y(),2)));
cout
计算两点间距离的公式应该也有问题,应该是 d = sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)) */
#include
#include
using namespace std;
class ZB
{
private:
int x;
int y;
double m;
public:
ZB(int a,int b)
{
x=a;
y=b;
}
int get_x()
{
return x;
}
int get_y()
{
return y;
}
double get_m()
{
return m;
}
void set(double n)
{
m=n;
}
};
void sqr(ZB j1,ZB j2)
{
j1.set(sqrt(pow(j1.get_x()-j2.get_x(),2)+pow(j1.get_y()-j2.get_y(),2)));
cout
我想知道我这个程序到底哪里出问题了!是使用对象作为函数参数计算两点之间的距离的问题的!
这个错误的公式到底哪里出问题了?
一道求极限的问题:我想知道我的计算步骤是不是哪里出错了?
电阻如何计算降压我想给一个小电机串上一个可调的电阻,作为调速,这个电机是4V的小直流电机,我要知道那些参数呢?如何计算,
CAD测算两点距离?初学软件,我想知道两条直线或两点之间的距离,
函数参数的计算顺序我用TC编程遇到一个问题比如这个程序:main (){int a=2;printf("%d %d %d
编写fun,其功能是:根据以下公式计算s,将结果作为函数值返回;n通过形参传入. 帮我看看我哪里出问题了?
我想知道我来到这个世界上到底是干什么的
用C 语言编程序计算平面上任意两点之间的距离.
帮帮忙看看我的代码哪里出问题了(有注释的)具体问题就是s[0]不知道为什么长度变成为0了
我想用Matlab画一分段函数的图像,提示z应该是一个矩阵,大神帮我看看哪里出问题了,我是初学者,
两点之间的距离计算公式