




已阅读5页,还剩9页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
参考答案参考答案 习题二习题二 P33 一 单选题 1 C2 B3 D4 C5 A6 D7 D8 B9 B10 D11 D12 C13 C 15 A 14 题最后一句应为 printf f n d y 结果为 2 2 二 填空题 1 182 intfloatdouble3 10114 八十六十5 三 阅读程序题 1 10 10 9 10 2 j 1 i 2 k 3 i 3 j 3 i 2 k 1 i 1 习题三习题三 P52 一 单选题 1 D2 C3 D4 B5 A6 B7 C8 A9 C10 B11 1 37777777777 4294967295 二 填空题 5 L6 1 三 阅读程序题 1 66 6 00 6 00 2 x 127 x 127 x 177 x 7f Y 123 4567 y 123 46 y 123 45670 3 2 1 4 1234 5 4 3 6 6 6 四 程序设计题 1 include stdio h include math h main float a b c d x1 x2 a 2 b 3 c 5 d b b 4 a c x1 b sqrt d 2 a x2 b sqrt d 2 a printf x1 2f x2 2f n x1 x2 2 include main w w w k h d a w c o m 课后答案网 float a v s scanf f v a a a s 6 a a printf v 2f s 2f n v s 3 include main int a b c t scanf d d d printf a d b d c d n a b c t c c b b a a t printf a d b d c d n a b c 4 include main char s1 s2 s1 getchar s2 s1 32 printf c n s2 习题四习题四 P70 一 单选题 1 C2 D3 D4 B5 A6 D7 D8 B9 C10 A11 B12 D13 passwarnerror 14 C15 C16 B17 B18 C 二 填空题 1 非 002 k 03 n 7 0 char c printf INPUTA B n scanf d c d switch c case printf d d d n a b a b break case printf d d d n a b a b break case printf d d d n a b a b break w w w k h d a w c o m 课后答案网 case printf d d d n a b a b break default printf INPUT ERROR 2 include main float x y scanf f if x 0 x 2 y 0 else if x 0 y x 1 x 2 else y x 1 x 2 printf y f n y 3 include main int g printf 请输入学生成绩 scanf d printf g d g switch g 10 case 10 printf A n break case 9 printf B n break case 8 printf C n break case 7 printf D n break case 6 printf E n break default printf F n 4 include main int x n 0 scanf d if x 10000 printf Data Error n else if x 10 n 1 else if x 100 n 2 else if x 1000 n 3 else n 4 w w w k h d a w c o m 课后答案网 printf n d n n 习题五习题五 P87 一 单选题 1 B2 D3 C4 C5 B6 C7 D8 C9 A10 D11 B12 B13 B14 D15 C 二 填空题 1 for 语句while 语句do while 语句 2 a 14 y 26 3 k 14 n 1 4 39 5 s 19 6 22222 7 10 8 7 9 8 10 5 5 三 改错题 应改为 for i 0 i 5 i j 应改为 int j 0 while j 10 j i j 注 while j 10 后不应有分号 应改为 while j 10 注 while j 10 后分号不能少 s i i 应改为 s i i continue 应改为 break 四 程序设计题 1 include main int i j s 0 for i 1 j 1 i 100 i j j 1 s s i j printf s d n s 1 另一做法 include main int i s for i 1 s 0 i 100 i if i 2 0 s s i else s s i printf d n s w w w k h d a w c o m 课后答案网 2 include main int i j s1 0 s2 0 for i 0 i0 s1 s1 j else s2 s2 j printf s1 d s2 d n s1 s2 3 include main int i s for i 6 s 0 i 96 i i 1 if i 10 6 i 10 6 s s i printf d n s 4 include main int i a b c for i 100 i 999 i a i 10 b i 10 10 c i 100 if i a a a b b b c c c printf d n i 5 include main int i j k 0 for i 1 i 4 i for j 1 j i j k printf d k 10 printf n w w w k h d a w c o m 课后答案网 6 include main int i j k 0 for i 3 i 3 i if i 0 k i else k i for j 1 j k j printf for j 1 j 7 2 k j printf printf n 习题六习题六 P111 一 单选题 1 D2 B3 C4 C5 C6 D7 A8 B 二 填空题 1 20019 2 数组名 3 越界 4 6 5 j ka j k 1 a j k 0 三 阅读程序题 1 654 321 2 aaa bbb ccc ddd 3 2 2 1 四 程序设计题 1 include main int a 4 4 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 int i j s 0 for i 0 i 4 i for j 0 j 4 j if i j i j 3 s a i j printf d s 2 include w w w k h d a w c o m 课后答案网 main char a 80 int i j 5 假设删除位置为 5 gets a for i j 1 a i 0 i a i a i 1 a i 0 puts a 3 include include main char a 80 int i j 5 假设插入位置为 5 char s t 假设插入字符为 t gets a for i strlen a i j i a i 1 a i a j t puts a 4 include main int a 3 5 1 3 5 7 9 2 4 6 8 10 3 5 8 7 6 int i j s1 3 0 s2 5 0 for i 0 i 3 i for j 0 j 5 j s1 i a i j for i 0 i 5 i for j 0 j 3 j s2 i a j i for i 0 i 3 i for j 0 j 5 j printf 6d a i j printf 6d n s1 i for i 0 i 33 i printf printf n for i 0 i 5 i printf 6d s2 i printf n 5 include w w w k h d a w c o m 课后答案网 main char s 3 80 int a 0 b 0 c 0 d 0 e 0 i j for i 0 i 3 i gets s i for i 0 i A else if s i j 32 d else e printf 3d 3d 3d 3d 3d a b c d e 习题七习题七 P145 一 单选题 1 A2 B3 C4 A5 C6 D7 C8 B9 B10 C11 D 二 填空题 1 该函数内局部 2 整型 3 k b return y 4 x i return ave fun a 20 5 1 add n 1 add n 6 n f n 1 0 f i 三 阅读程序 写出运行结果 1 10 20 30 2 64 3 8 4 hlo 5 sum 55 四 程序设计题 1 include main float add float float sub float float float aver float float a b w w w k h d a w c o m 课后答案网 scanf f f printf add f sub f n add a b sub a b printf aver f aver a b float add float x float y return x y float sub float x float y return x y float aver float x float y return x y 2 2 include main int a b c abmax int int scanf d d d printf max d n abmax abmax a b c int abmax int a int b if a b return a else return b 3 include main float x fun float int int n scanf f d printf f n fun x n float fun float x int n float y if n 0 y 1 else y x fun x n 1 return y 4 include main long f int int n k scanf d for k 1 k n k printf ld f k printf n long f int n long y if n 2 y 1 w w w k h d a w c o m 课后答案网 else y f n 1 f n 2 return y 5 include include main char a 50 int n void fun char x int n gets a n strlen a fun a n puts a void fun char a int n int k s for k 0 k n 2 k s a k a k a n k 1 a n k 1 s 5 另一做法 include include main char a 50 int n void fun char x int n gets a n strlen a fun a n puts a void fun char a int n int k char b 50 for k 0 k n k b n 1 k a k b k a k strcpy a b 6 include define KK 100 main w w w k h d a w c o m 课后答案网 char a KK long sjz char a int i 0 f1 0 printf input a data gets a for i 0 a i 0 i if a i 0 return n 6 另一做法 include define KK 100 main char str KK c long sjz char a int i 0 f1 0 printf input a data while c getchar n p a for q a q a 10 q scanf d q for q a q a 10 q printf 5d q printf n q for p q p q t p p q q t for p a p a 10 p printf 5d p printf n 2 include w w w k h d a w c o m 课后答案网 include void main char a 50 p1 p2 t n gets a n strlen a p1 a p2 a n 1 for p1 p2 p1 p2 t p1 p1 p2 p2 t puts a 另一做法 include main char str 20 p str gets str while p p p while p str printf c p p printf n 3 include main int a 10 p max min t for p a p a 10 p scanf d p for p a p a 10 p printf 5d p printf
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 中国移动荆州市2025秋招行业解决方案岗位专业追问清单及参考回答
- 资阳市中石油2025秋招面试半结构化模拟题及答案油田勘探开发岗
- 郴州市中石油2025秋招笔试英语专练题库及答案
- 2025年会计文案考试题及答案
- 历史玄学考试试题及答案
- 平凉市中石化2025秋招面试半结构化模拟题及答案财务与审计岗
- 廊坊市中石化2025秋招笔试英语专练题库及答案
- 忻州市中储粮2025秋招购销统计岗高频笔试题库含答案
- 衢州市中石油2025秋招笔试模拟题含答案法律与合规岗
- 中国广电上饶市2025秋招笔试行测题库及答案财务审计类
- 2025机采棉作业合同协议书范本
- 树木学试题及答案北林
- 财政补贴政策在促进农村电商发展的扶持效果可行性分析报告
- 2025第三季度作风建设党课以忠诚廉洁担当的政治品格奋力书写高质量发展新答卷
- 打井设备成套转让协议书
- 组织结构的权力与权威
- 宠物急救标准化流程
- 2025届广东广州地铁集团有限公司校园招聘笔试参考题库附带答案详解(10套)
- 教师信息技术数字资源开发计划
- 低钾血症护理常规业务学习
- 送货服务方案
评论
0/150
提交评论