网站大量收购独家精品文档,联系QQ:2885784924

吕凤翥C 语言程序设计答案(1-5).doc

  1. 1、本文档共9页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
吕凤翥C 语言程序设计答案(1-5)

答案 1.2 选择填空 1 2 3 4 5 C D A A B 1.3 判断对错 1 2 3 4 5 6 7 8 9 10 √ × √ × √ √ × × × × 1.4程序分析 (1)()8 7 x=8, y=7 x-y=1 ()r=ki+j=26 1.5 编译下列程序,改正所出现的错误,并分析输出结果。(红色为改正地方) (1) #includeiostream.h void main() { coutThis is a program.; } 输出结果:This is a program. (2) #includeiostream.h void main( ) { int x; cinx; int y=x*x; couty=y\n; } 输出结果:3 y=9 (3) #include iostream.h void main ( ) {int a,b; a=5; b=3; int s=a+b; couta+b=s\n; } 输出结果:a+b=8 答案 2.2 选择填空 1 2 3 4 5 6 7 8 9 10 B C A B C D D C C B C 2.3 判断对错 1 2 3 4 5 6 7 8 9 10 × √ × √ × × √ √ × √ 2.4 分析下列程序的输出结果 (1) 90;34.92;12.7865 67,65 (2) P 1234567 1.98765 (3) 3,4,5,8 5.6,0,1.8059e-307 5,8,2 (4) abde abcde edcba abcd,ijkl,sxyz 74HK (5) 1.5e+006 0.005 mnp xyabc \abc//mnpxyz 答案 3.2 选择填空 1 2 3 4 5 6 7 8 9 10 A A D D C D C A D D 3.3 判断对错 1 2 3 4 5 6 7 8 9 10 √ × × √ × × × × × √ 3.4 分析下列程序的输出结果 (1) 63,45 18,45 88,3 (2) 3 80 1 9,20 (3) 53,22 -2,0 1 1 3.5 已知,inta(8),b(4);求出下列表达式的值以及a和b的值。 (1)0 a=8 b=4 (2)1 a=8 b=4 (3)3 a=2 b=4 (4)16 a=10 b=5 (5)12 a=8 b=4 (6)1 a=8 b=4 3.6 按下列要求编写程序。 (1) #includeiostream.h void main() { float a,b; cinab; cout两数中的小者为:(ab?a:b)endl; } (2) #includeiostream.h void main() { int a; float b; cinab; if(ab) cout两数中的较大的数为:aendl; else cout两数中的较大的数为:bendl; } (3) #include iostream.h void main() { float c,f; cout摄氏温度:; cinc; f=9*c/5+32; cout华氏温度:fendl; } (4) #include iostream.h const float r=1.60934; void main() { float m,I; cout 公里数:; cinm; I=r*m; cout英里数:Iendl; } (5) #include iostream.h void main() { int n,m; cout输入一个整数:; cinn; m=n|15; cout结果为:mendl; } 答案 4.2 选择填空 1 2 3 4 5 6 7 8 9 10 C A B D D A C AB B D 4.3 判断对错 1 2 3 4 5 6 7 8 9 10 × √ × × √ √ √ √ √ × 4.4 分析下列程序的输出结果 (1) 49 47 43 41 (2) 7 Ok (3) 6 8 (4) 5 3 1 -1 (5) 1,2 (6) SWITCH WAMP (7) 20 4.5按下列要求编程。 (1) #include iostream.h void main() { int i=1,s=0; while(i=99) { s=s+i; i+=2; } couts=sendl; } (2) #include iostream.h void main() { for(int i=1;i=5;i++)

文档评论(0)

htfyzc + 关注
实名认证
内容提供者

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

1亿VIP精品文档

相关文档