首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
阅读以下说明和C++码,将应填入(n)处的字名写在的对应栏内。 [说明] 设计一个普通函数distance (Point &p1,Point &p2),用于计算p1和p2点之间的距离。本程序执行结果如下:(2,2)与(5,5)之间距离=4.24264
阅读以下说明和C++码,将应填入(n)处的字名写在的对应栏内。 [说明] 设计一个普通函数distance (Point &p1,Point &p2),用于计算p1和p2点之间的距离。本程序执行结果如下:(2,2)与(5,5)之间距离=4.24264
admin
2013-01-05
16
问题
阅读以下说明和C++码,将应填入(n)处的字名写在的对应栏内。
[说明] 设计一个普通函数distance (Point &p1,Point &p2),用于计算p1和p2点之间的距离。本程序执行结果如下:(2,2)与(5,5)之间距离=4.24264
# include < iostream. h >
# include < math. h >
class Point
{
int x, y;
public:
Point(int i, int j) { (1)
int getx( ) { return x;}
int gety( ) { return y; }
void disp( )
{
(2)
}
};
float distance( Point &p1, Point &p2 )
{
float d;
(3)
return d;
}
void main( )
{
(4)
p1. disp ( ); cout < <“与”; p2. diap( );
cout< <“之间距离=” < <distance (p1,p2) < <end1;
}
选项
答案
x=i; y=j; clout< <"(" < d = sqrt((p1. getx( ) - p2. getx( ) ) *( p1. getx( ) - p2. getx( ) ) +(p1. gety( ) - p2. gety( ) ) *( p1. gety () - p2. gety( ) ); Point p1(2,2) ,p2(5,5);
解析
转载请注明原文地址:https://jikaoti.com/ti/Hpi7FFFM
本试题收录于:
软件设计师下午应用技术考试题库软考中级分类
0
软件设计师下午应用技术考试
软考中级
相关试题推荐
在结构化分析模型中,______描述了所有在目标系统中使用的和生成的数据对象。
分配给某公司网络的地址块是210.115.192.0/20,该网络可以被划分为()个C类子网。
用边界值分析法,假定X为整数,10≤X≤100,那么X在测试中应该取(40)边界值。
“<titlestyle="italic">science</title>”是XML中一个元素的定义,其中元素的内容是(29)。
用户可以通过http://www.a.com和http://www.b.com访问在同一台服务器上(70)不同的两个Web站点。
能够主动采集信息,分析网络攻击行为和误操作的实时保护策略是指(64)。
如果防火墙采用.NAPT技术,则该单位至少需要申请(1)个可用的公网地址。1.ACL默认执行顺序是(5),在配置时要遵循(6)原则、最靠近受控对象原则、以及默认丢弃原则。(5)、(6)备选项(A)最大特权(B)最小特权(C)随机选取(D)自左到右
对文法G进行改写,然后对每个非终结符写出不带回溯的递归于程序。说明输入串(a,a)#是否为G的句子。
阅读下列说明和C程序,将应填入(n)处的字句写在对应栏中。[说明]借助一个栈结构,可实现二叉树的非递归遍历算法。InOrderTraverse数实现中序非递归遍历,遍历过程如下:若不是空树,根节点入栈,进入左子树;若已
随机试题
为了区分各地自然区域的筑路特性,制定了《公路自然区划标准》(JTJ003—86),该区划是根据()制定的。
菌痢的潜伏期为
患者,女,22岁。左眼戴角膜接触镜后,红痛3天。查:左眼矫正视力0.8,结膜混合充血,角膜上有直径2mm的灰白色浸润灶,荧光素染色阳性,前房Tyndall阳性但无积脓。最有可能的诊断是
与子宫内膜癌预后关系最为密切的临床病理因素是下列哪项
患者,男,49岁。呕吐吞酸,嗳气频繁,胸胁满痛,舌边红,苔薄腻,脉弦。治法为
在适用下列各种审判程序进行审理时,人民法院不能进行调解的是:
场景某机电安装工程公司承担了某机械厂的电力安装任务。该项目地理位置在郊区,地处偏僻,虽用电申请已受理,但距电网引入的路线施工和通道尚需一段时日,而工程又急需开工,总承包单位通常是用自备电源(如柴油发电机等)先行解决用电问题。此时,总承包单位要告知供电部门
价格变动会引起需求量变动。在日常生活中,价格变动对需求量影响较小的一组商品是()。
根据我国宪法和其他有关规定,全国行政编制总额的核定权和调整权属于()
关于线性表的顺序查找、折半查找、分块查找方法的叙述中,错误的是______。A.顺序查找的算法非常简单,但效率较低B.折半查找法的平均查找长度小,查找速度快C.分块查找的平均长度介于顺序查找和折半查找之间D.分块查找只能用于顺序存储结构,且要求表中
最新回复
(
0
)