2013-204西南交大面向对象程序设计第3次作业.docVIP

2013-204西南交大面向对象程序设计第3次作业.doc

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
  4. 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
  5. 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们
  6. 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
  7. 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
2013-204西南交大面向对象程序设计第3次作业

(注意:若有主观题目,请按照题目,离线完成,完成后纸质上交学习中心,记录成绩。在线只需提交客观题答案。 一、主观题 共5道小题 1. 声明一个rectangle和circle类,rectangle和circle类都有getArea()函数用于计算矩形(retangle)对象和圆形(circle)对象的面积,在main中初始化一个矩形类对象和一个圆形类对象并利用getArea函数求出面积。 参考答案: #include class circle public: circle float r radius r; float getArea ; private: float radius; ; float circle::getArea return 3.14*radius*radius; class rectangle public: rectangle float l1,float w1 l l1;w w1 float getArea ; private: float l,w; ; float rectangle::getArea return l*w; void main circle circle1 3 ; rectangle rec1 3,5 ; cout cout 2. 定义Boat与Car两个类,二者都有weight属性,定义二者的一个友元函数totalWeight(),计算二者的重量和。 参考答案: 3. 定义point类来描述平面上的点,包含私有数据成员x和y。定义友元函数Distance计算两点距离 参考答案: 4. 定义复数类,重载+,*为复数类的成员函数,实现复数类对象的+,*运算。 参考答案: 5. 编写程序声明类Point,有数据成员X,Y,为其定义友元函数实现重载+。 参考答案: integrated energy, chemicals and textile Yibin city, are the three core pillars of the industry. In 2014, the wuliangye brand value to 73.58 billion yuan, the citys liquor industry slip to stabilise. Promoting deep development of integrated energy, advanced equipment manufacturing industry, changning district, shale gas production capacity reached 277 million cubic metres, built the countrys first independent high-yield wells and pipelines in the first section, the lead in factory production and supply to the population. 2.1-3 GDP growth figure 2.1-4 Yibin, Yibin city, Yibin city, fiscal revenue growth 2.1.4 topography terrain overall is Southwest, North-Eastern State. Low mountains and hills in the city landscape as the main ridge-and-Valley, pingba small fragmented nature picture for water and the second land of the seven hills. 236 meters to 2000 meters above sea level in the city, low mountain, 46.6% hills 45.3%, pingba only 8.1%. 2.1.5 development of Yibin landscapes and distinctive feature in the center of the city, with limitations, and spatial structure of typical zonal group, 2012-cities in building with an area of about 76.2km2. From city-building situation, old town-th

文档评论(0)

drj776 + 关注
实名认证
文档贡献者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档