文件名称:4
-
所属分类:
- 标签属性:
- 上传时间:2013-12-17
-
文件大小:268.9kb
-
已下载:1次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
1. 编写程序:设计一个用来表示直角坐标系上点的位置的Location类,然后在主程序中
创建两个对象a和b,要求a在第三象限,b在第二象限,计算给定两点之间的距离并按如下格式输出结果:
a(x1,y1),b(x2,y2)
Distance = d
提示:
i. 在直角坐标系上确定一个点的位置,需要两个坐标值(x,y)。因此,Location类的数据成员有两个,既x和y,并将其设为私有的,不允许类外的对象直接访问。
ii. 定义3个成员函数,构造函数Location(int initX, int initY)设置点的坐标;GetX()取得点的横坐标;GetY取得点的纵坐标。
iii. d2=(x2-x1)2+(y2-y1)2
-1 programming: Design a class to represent Location location points on a Cartesian coordinate system, and then create two objects a and b in the main program, a requirement in the third quadrant, b in the second quadrant, calculated for a given the distance between the two points and then output the following format: a (x1, y1), b (x2, y2) Distance = d Tip:. i determine the location of a point in the Cartesian coordinate system, two coordinate values ( x, y). Therefore, the data members Location class has two, both x and y, and set it to private, foreign object classes do not allow direct access. . ii define three member functions, constructors Location (int initX, int initY) coordinates of the set point GetX () made the point abscissa GetY get ordinate points. iii. d2 = (x2-x1) 2+ (y2-y1) 2
创建两个对象a和b,要求a在第三象限,b在第二象限,计算给定两点之间的距离并按如下格式输出结果:
a(x1,y1),b(x2,y2)
Distance = d
提示:
i. 在直角坐标系上确定一个点的位置,需要两个坐标值(x,y)。因此,Location类的数据成员有两个,既x和y,并将其设为私有的,不允许类外的对象直接访问。
ii. 定义3个成员函数,构造函数Location(int initX, int initY)设置点的坐标;GetX()取得点的横坐标;GetY取得点的纵坐标。
iii. d2=(x2-x1)2+(y2-y1)2
-1 programming: Design a class to represent Location location points on a Cartesian coordinate system, and then create two objects a and b in the main program, a requirement in the third quadrant, b in the second quadrant, calculated for a given the distance between the two points and then output the following format: a (x1, y1), b (x2, y2) Distance = d Tip:. i determine the location of a point in the Cartesian coordinate system, two coordinate values ( x, y). Therefore, the data members Location class has two, both x and y, and set it to private, foreign object classes do not allow direct access. . ii define three member functions, constructors Location (int initX, int initY) coordinates of the set point GetX () made the point abscissa GetY get ordinate points. iii. d2 = (x2-x1) 2+ (y2-y1) 2
(系统自动生成,下载前可以参看下载内容)
下载文件列表
4/
4/4.cpp
4/4.exe
4/4.obj
4/tctemp.dat
4/tempfile.exe
4/4.cpp
4/4.exe
4/4.obj
4/tctemp.dat
4/tempfile.exe
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.