文件名称:Exercises-of-the-first-experiment
下载
别用迅雷、360浏览器下载。
如迅雷强制弹出,可右键点击选“另存为”。
失败请重下,重下不扣分。
如迅雷强制弹出,可右键点击选“另存为”。
失败请重下,重下不扣分。
介绍说明--下载内容均来自于网络,请自行研究使用
北京理工大学面向对象程序设计第五次上机习题答案~-Here is the definition of Point:
class Point
{
private:
double X, Y
public:
void SetPoint(double a, double b)
}
void Point::SetPoint(double a, double b)
{
X = a Y = b
}
a) define a member function Distance calculating the distance between two points, and arguments what you need.
b) define a friend function Distance calculating the distance between two points, and arguments what you need.
Please complete the couple of functions above, so its can be used as follows:
void main()
{
Point P1(10,20), P2
P2.SetPoint(38.2, 76.9)
// Use different methods to calculate the distance between two points.
double D1 = P1.Distance(P2)
double D2 = Distance(P1, P2)
}
class Point
{
private:
double X, Y
public:
void SetPoint(double a, double b)
}
void Point::SetPoint(double a, double b)
{
X = a Y = b
}
a) define a member function Distance calculating the distance between two points, and arguments what you need.
b) define a friend function Distance calculating the distance between two points, and arguments what you need.
Please complete the couple of functions above, so its can be used as follows:
void main()
{
Point P1(10,20), P2
P2.SetPoint(38.2, 76.9)
// Use different methods to calculate the distance between two points.
double D1 = P1.Distance(P2)
double D2 = Distance(P1, P2)
}
(系统自动生成,下载前可以参看下载内容)
下载文件列表
Exercises of the first experiment\Part I. Exercises in the book.txt
.................................\Part II. Main.txt
.................................\Part III. Set.txt
.................................\Part IV. Programming about friend.txt
Exercises of the first experiment