首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
阅读以下说明和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
15
问题
阅读以下说明和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://kaotiyun.com/show/9YDZ777K
本试题收录于:
软件设计师下午应用技术考试题库软考中级分类
0
软件设计师下午应用技术考试
软考中级
相关试题推荐
某汽车维修公司有部门、员工和顾客等实体,各实体对应的关系模式如下:部门(部门代码,部门名称,电话)员工(员工代码,姓名,部门代码)顾客(顾客号,姓名,年龄,性别)维修(顾客号,故障情况,维修日期,员工代码)假设每个部门允许有多部电话,则电话属性为
某汽车维修公司有部门、员工和顾客等实体,各实体对应的关系模式如下:部门(部门代码,部门名称,电话)员工(员工代码,姓名,部门代码)顾客(顾客号,姓名,年龄,性别)维修(顾客号,故障情况,维修日期,员工代码)假设每个部门允许有多部电话,则电话属性为
某汽车维修公司有部门、员工和顾客等实体,各实体对应的关系模式如下:部门(部门代码,部门名称,电话)员工(员工代码,姓名,部门代码)顾客(顾客号,姓名,年龄,性别)维修(顾客号,故障情况,维修日期,员工代码)假设每个部门允许有多部电话,则电话属性为
从认证中心CA获取用户B的数字证书,该证书用______做数字签名,从用户B的数字证书中可以获得B的公钥。
(35)测试用例设计方法既可以用于黑盒测试,也可以用于白盒测试。
下图是①设计模式的类图,该设计模式的目的是②,图中,Abstraction和RefinedAbstraction之间是③关系,Abstraction和Implementor之间是④关系。④处应填入?
用边界值分析法,假定X为整数,10≤X≤100,那么X在测试中应该取(40)边界值。
若C程序的表达式中引用了未赋初值的变量,则______。
表示“以字符a开头且仅由字符a、b构成的所有字符串”的正规式为______。
阅读以下说明,回答问题1至问题3,将解答填入解答栏内。【说明】某公司租用了一段C类地址203.12.11.0/24~203.12.14.0/24,如下图所示。其网间地址是172.11.5.14/24。要求网内所有PC都能上网。
随机试题
患者男性,65岁,发现下睑硬结1个月余。体检发现硬结在睑缘皮肤黏膜移行处,边界不规则,边缘质硬隆起。完善相关检查,肿瘤仅有局部侵犯,没有淋巴结及远处转移,取细胞学眼睑鳞状细胞癌。正确的治疗原则是
男性,52岁。因咳嗽、痰血伴体重减轻2个月就诊,检查发现右肺上叶空洞性病变,洞壁光整,疑为结核。结核病空洞的特征应是
A.组织接种单位销毁B.立即停止销售C.对该疫苗依法查封、扣押D.采取应急处置措施依照《疫苗流通和预防接种管理条例》的规定接到质量可疑疫苗报告的药品监督管理部门应()
生产经营单位对重大危险源应当登记建档,进行定期检测、评估、监控,并制定应急预案,告知从业人员和相关人员在紧急情况下应当()。
某企业年赊销收入为360元,信用条件为“2/10,n/30”时,预计有20%的客户选择现金折扣优惠,其余客户在信用期付款,变动成本率为60%,资金成本率为8%,则应收账款占用资金的应计利息为()元。(1年按360天计算)
2017年3月11日,甲公司签发一张商业汇票,收款人为乙公司,到期日为2018年9月11日,甲公司的开户银行P银行为该汇票承兑。2018年6月30日,乙公司从丙公司采购一批货物,将该汇票背书转让给丙公司,丙公司9月30日持该汇票到其开户银行Q银行办理委托收
政府制定或调整重大劳动关系标准应当贯彻“三方原则”,其中“三方”指的是()。
全国人大代表,在全国人大闭会期间非经()的许可,不受逮捕或刑事审判。
关于假释,下列选项正确的是
在考生文件夹下,打开文档WORD1.docx,按照要求完成下列操作并以该文件名(WORD1.docx)保存文档。【文档开始】认识AGF8X要想深入认识AGP8X,让我们先来说说AGP总线这个话题吧。我们知道最初的
最新回复
(
0
)