c++第三版(吕凤翥)习题参考答案完整版_第1页
c++第三版(吕凤翥)习题参考答案完整版_第2页
c++第三版(吕凤翥)习题参考答案完整版_第3页
c++第三版(吕凤翥)习题参考答案完整版_第4页
c++第三版(吕凤翥)习题参考答案完整版_第5页
已阅读5页,还剩4页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、第1章 习题答案习题1.1 (略) 习题1.5 (略)习题1.2 选择题 CDAAB习题1.3 判断题 对者:1,3,5,6,10习题1.4 分析程序结果1. BeiJing ShangHai TianJing2. x=8,y=7x-y=1 3. r=k:i+j=26第2章 习题答案习题2.1 (略)习题2.2 选择题 BDABD DCCBC习题2.3 判断题 对者:2,4,8,10习题2.4 分析程序结果1. 90; 34.92; 12.786567,652. P1234567 1.987653. 3,4,5,85.6,0,?5,8,24. abdeabcde edcba abcd,ijkl

2、,sxyz 74HK5. 1.5e+0060.005mnp xyabcabv|mnp xyz第3章 习题答案习题3.1 (略) 习题3.6 编程 (略)习题3.2 选择题 AADDD DCADD习题3.3 判断题 对者:1,2,4,10习题3.4 分析程序结果1. 63,4518,4588,32. 38019,203. 53,22-2,011习题3.5 表达式值1. 02. 13. 34. 165. 126. 1第4章 习题答案习题4.1 (略)习题4.2 选择题 CABDD ACBBD习题4.3 判断题 对者:2,5,6,7,8,9习题4.4 分析程序结果1. 494743412. 7OK3

3、. 684. 53 1 -15. 1,26. SWTTCH WAMP7. 20第5章 习题答案习题5.1 (略)习题5.2 选择题 DABBD CBACB习题5.3 判断题 对者:1,2,4,6,8,10习题5.4 分析程序结果1. 7911132. 153. 6,14. 5!+4!+3!+2!+1!=1535. 8,8,86. Sum1=10Sum2=15Sum3=207. a=10,b=58. m200good第6章 习题答案习题6.1 (略)习题6.2 选择题 ADDDC DADAC ACD (第8题无正确答案,只是选项D的等号两边指针级别是一样,但数组名是不能赋值的)习题6.3 判断题

4、 对者:1,5,6,7,8,9,10,11,13习题6.4 分析程序结果1. 42. 153. 12,10,9,6,5,4,3,2,1,4. 4,4,4,4,45,5,5,5,57,7,7,7,78,8,8,8,85. sum=37.866. 5.32,5.323.9,3.957. a+b=398. 10 11 12 13 14 15 16 17 18 19习题6.5 编程 (略)第7章 习题答案习题7.1 (略)习题7.2 选择题 DBCAC习题7.3 判断题 对者:1,2,6,10习题7.4 分析程序结果1. Ma ping,95.52. Ma 89.53. 62021224. d siz

5、e8d.d size8abc size8d.i=975. word value:4241low value:Ahigh value:B习题7.5 编程 (略)第8章 习题答案习题8.1 (略)习题8.2 选择题 DCBAC ACB(A)BA CA习题8.3 判断题 对者:1,3,5,8,10,12习题8.4 分析程序结果1. Default constructor called.Constructor called.a1=0.a2=0a1=3,a2=92. b1=12,b2=65a=1003. 123455543214. m1=68,m2=1565. 11,2,3,4,5,6,7,8,9,10

6、101,2,3,4,5,6,7,8,9,10,11,12l,13,14,15,16,17,18,19,20,21,22,23,24,2525,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,16. Constructor called.0Constructor called.5Destructor called.55Destructor called.57. Constructor called.1010Destructor called.10第9章 习题答案习题9.1 (略)习题9.2 选择题 CBABA DBDBD习

7、题9.3 判断题 对者:2,4,5,6,7,8,10习题9.4 分析程序结果1. Starting1:Default constructor called.Default constructor called.Default constructor called.Endting1:Starting2:Constructor:a=5,b=6Constructor:a=7,b=8Constructor:a=9,b=10Endting2.Destructor called.a=9,b=10Destructor called.a=7,b=8Destructor called.a=5,b=6Destru

8、ctor called.a=5,b=6Destructor called.a=3,b=4Destructor called.a=1,b=22. Default constructor called.Default constructor called.Default constructor called.Default constructor called.Destructor called.Constructor1 called.Destructor called.Constructor2 called.Destructor called.x=0,y=0x=7,y=0x=5,y=9 Dest

9、ructor called.Destructor called.Destructor called.3. Default Constructor called.0,0Destructor called.Constructor called.5,8Destructor called.4 10 11 12 13 1420 21 22 23 245 Default constructor called.Constructor:real=6.9,imag=0Constructor:real=12.2,imag=25.80+0i9+0i12.2+25.8iConstructor:real=0.8,ima

10、g=0.5Constructor:real=55,imag=0Default Constructor called.0.8+0.9i55+0i0+0i8. Constructor called.0Constructor called.5Destructor called.55Destructor called.59. Constructor called.1010Destructor called.10 习题9.5(1) 答:该程序中调用了三个字符串处理函数:strlen()、strcpy()和strcat()。它们都被己含在string.h文件中。(2) 答:该程序的String类中使用了函

11、数重载方法。对构造函数进行了重载,下述两个函数是重载构造函数。Strint()和String(const char *str)。(3) 答:Setc()函数的功能是改变字符数组Buffer中指定元素的字符值。(4) 答:Getc()函数的功能是输出显示字符数细中指定元素的字符值。(5) 答: Append()函数的功能是将指定的字符串加到某个对象的字符数组成员中去。(6) 答:可以(7) 答:该程序中用了两处new运算符。(8) 答:输出结果如下: cmpty.a string.9 a stping.iThis a string.第10章 习题答案习题10.1 (略)习题10.2 选择题 CA

12、ADB习题10.3 判断题 对者:1,4,5,6,10习题10.4 分析程序结果5. (1,2)5,6(10,12)2. (1,2)(6,9)5,6(6,9)3. (13,22,30,40)4. D2:display()pri=4,pr2=5pri4=6pri12=7D2:display()pri=4,pr2=5pri4=7pri12=85. D2:display()pri=1,pr2=4pri4=6pri12=7D2:display()pri=3,pr2=4pri4=7pri12=8第11章 习题答案习题11.1 (略)习题11.2 选择题 CDABA CCA习题11.3 判断题 对者:1,3,4,5,6, 9,10习题11.4 分析程序结果1. 15,16,17,18,19,2. B:Show() called.155D:Show().2053. B:virfun() Called.D:virfun() Called.4. The A version AThe D1 info:4 version 1The D2 info:100 version AThe D3 info:-25 version 35. 72.380221.2第

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论