文件名称:Exercises-of-the-first-experiment
-
所属分类:
- 标签属性:
- 上传时间:2016-06-01
-
文件大小:1.39kb
-
已下载:4次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
北京理工大学面向对象程序设计第五次上机习题答案~-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
Exercises of the first experiment/Part II. Main.txt
Exercises of the first experiment/Part III. Set.txt
Exercises of the first experiment/Part IV. Programming about friend.txt
Exercises of the first experiment
Exercises of the first experiment/Part II. Main.txt
Exercises of the first experiment/Part III. Set.txt
Exercises of the first experiment/Part IV. Programming about friend.txt
Exercises of the first experiment
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.