您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 质量控制/管理 > c++第三版(吕凤翥)习题参考答案完整版
1第1章习题答案习题1.1(略)习题1.5(略)习题1.2选择题CDAAB习题1.3判断题对者:1,3,5,6,10习题1.4分析程序结果1.BeiJingShangHaiTianJing2.x=8,y=7x-y=13.r=k:i+j=26第2章习题答案习题2.1(略)习题2.2选择题BDABDDCCBC习题2.3判断题对者:2,4,8,10习题2.4分析程序结果1.90;34.92;12.786567,652.P12345671.987653.3,4,5,85.6,0,?5,8,24.abdeabcdeedcbaabcd,ijkl,sxyz74HK5.1.5e+0060.005mnpxyabc\abv||mnp’xyz’第3章习题答案习题3.1(略)习题3.6编程(略)习题3.2选择题AADDDDCADD习题3.3判断题2对者: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选择题CABDDACBBD习题4.3判断题对者:2,5,6,7,8,9习题4.4分析程序结果1.494743412.7OK3.684.531-15.1,26.SWTTCHWAMP7.203第5章习题答案习题5.1(略)习题5.2选择题DABBDCBACB习题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选择题ADDDCDADACACD(第8题无正确答案,只是选项D的等号两边指针级别是一样,但数组名是不能赋值的)习题6.3判断题对者: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.8646.5.32,5.323.9,3.957.a+b=398.10111213141516171819习题6.5编程(略)第7章习题答案习题7.1(略)习题7.2选择题DBCAC习题7.3判断题对者:1,2,6,10习题7.4分析程序结果1.Maping,95.52.Ma89.53.62021224.dsize8d.dsize8abcsize8d.i=975.wordvalue:4241lowvalue:Ahighvalue:B习题7.5编程(略)第8章习题答案习题8.1(略)习题8.2选择题DCBACACB(A)BACA习题8.3判断题对者:1,3,5,8,10,12习题8.4分析程序结果1.Defaultconstructorcalled.Constructorcalled.a1=0.a2=0a1=3,a2=92.b1=12,b2=65a=1003.1253455543214.m1=68,m2=1565.1{}{1,2,3,4,5,6,7,8,9,10}10{1,2,3,4,5,6,7,8,9,10,11,12l,13,14,15,16,17,18,19,20,21,22,23,24,25}{25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1}6.Constructorcalled.0Constructorcalled.5Destructorcalled.55Destructorcalled.57.Constructorcalled.1010Destructorcalled.10第9章习题答案习题9.1(略)习题9.2选择题CBABADBDBD习题9.3判断题对者:2,4,5,6,7,8,10习题9.4分析程序结果1.Starting1:Defaultconstructorcalled.Defaultconstructorcalled.Defaultconstructorcalled.Endting1:Starting2:Constructor:a=5,b=6Constructor:a=7,b=8Constructor:a=9,b=10Endting2.Destructorcalled.a=9,b=106Destructorcalled.a=7,b=8Destructorcalled.a=5,b=6Destructorcalled.a=5,b=6Destructorcalled.a=3,b=4Destructorcalled.a=1,b=22.Defaultconstructorcalled.Defaultconstructorcalled.Defaultconstructorcalled.Defaultconstructorcalled.Destructorcalled.Constructor1called.Destructorcalled.Constructor2called.Destructorcalled.x=0,y=0x=7,y=0x=5,y=9Destructorcalled.Destructorcalled.Destructorcalled.3.DefaultConstructorcalled.0,0Destructorcalled.Constructorcalled.5,8Destructorcalled.4101112131420212223245Defaultconstructorcalled.Constructor:real=6.9,imag=0Constructor:real=12.2,imag=25.80+0i9+0i12.2+25.8iConstructor:real=0.8,imag=0.5Constructor:real=55,imag=0DefaultConstructorcalled.0.8+0.9i55+0i0+0i78.Constructorcalled.0Constructorcalled.5Destructorcalled.55Destructorcalled.59.Constructorcalled.1010Destructorcalled.10习题9.5(1)答:该程序中调用了三个字符串处理函数:strlen()、strcpy()和strcat()。它们都被己含在string.h文件中。(2)答:该程序的String类中使用了函数重载方法。对构造函数进行了重载,下述两个函数是重载构造函数。Strint()和String(constchar*str)。(3)答:Setc()函数的功能是改变字符数组Buffer[]中指定元素的字符值。(4)答:Getc()函数的功能是输出显示字符数细中指定元素的字符值。(5)答:Append()函数的功能是将指定的字符串加到某个对象的字符数组成员中去。(6)答:可以(7)答:该程序中用了两处new运算符。(8)答:输出结果如下:cmpty.astring.9astping.iThisastring.第10章习题答案习题10.1(略)习题10.2选择题CAADB习题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)84.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选择题CDABACCA习题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.TheAversionATheD1info:4version1TheD2info:100versionATheD3info:-25version35.72.380221.29第12章习题答案习题12.1(略)习题12.2选择题BCDBACADCD习题12.3判断题对者:2,4,5,6,8,9,10习题12.4分析程序结果1.123456789aabbccddeeffmmmnnnpppqqqok!2.123456789abcdefghijkl3.Hi,goodmorning!4.decVal:1000otcVal:512hexVal:4096
本文标题:c++第三版(吕凤翥)习题参考答案完整版
链接地址:https://www.777doc.com/doc-4220633 .html