标准C语言程序设计第五版课后练习题答案

标准C语言程序设计第五版课后练习题答案


2024年1月13日发(作者:)

课后练习题答案

Chapter 1

1.1 ×√×√√×√××√

1.2 b c

1.3 ad

1.4 semicolon printf math.h n

Chapter 2

2.1 ×√××√√×√××√×

2.2 typedef 255 external const

Chapter 3

3.1 ×√××√√×××√√√

3.2 integer modula 6 logical sizeof paratheses typeconversion precedence

3.3 F F T F F F

3.4 F T T T F

3.5 (b) (c)

3.6 0 -2 7 10.25 false 3 3 1

3.10 0 1 1 1 1

3.11

d

}

100

3.12

110

111

3.13 1

3.14 200

3.15 x<=y

3.16 TRUE

3.19

2

1

4

3.20

-40

40

Chapter 4

4.1 ×√√√√√××√√√×

4.2 %hd %x ctype.h %l %*d [^] blank 6 - %e

4.4 (a) scanf(“%d %c %d”, &a, &b, &c); (b)scanf(“%d %f %s”, &a, &b, &c);

(c) scanf(“%d-%d-%d”, &a, &b, &c); (d) scanf(“%d %s %d”, &a, &b, &c);

4.5 (a)10x1.230000 (b)1234x 1.23 (c)1234 456.000000 (d) “123.40 ”

(e) 1020 1222(乱码)

4.7 (a)1988 x (b)乱码 (c)120 乱码 (d)乱码 x

4.8 (a)1275 -235.740000

(b) 1275

-235.740000

(c) 0 0.000000

(d) 1275xxxx-235.74

(e)Cambridge

(f)1275 Cambridge

4.10 1988 无 无

Chapter 5

5.1 √×√××××××√

5.2 && switch break if-else x=y

5.4 (a)x = 2; y = 0; (b) x = 1; y = 0;

5.5 (a) if (grade <= 59)

if (grade >= 50)

second = second + 1;

(b) if (number > 100) printf(“out of range”);

else if (number < 0) printf(“out of range”);

else sum = sum + number;

(c)

if (T > 200) printf(“admitted”);

else if (M > 60)

{if (M > 60) printf(“admitted”);}

else printf(“not admitted”);

5.6 F T F T

5.8 (a) x > 10 (b) (x != 10)||(y ! = 5) || (z >= 0)

(c) (x + y != z) || (z > 5) (d) (x > 5) || (y != 10) || (z >= 5)

5.9 (a) x = 5; y = 10; z = 1 (b) x = 5; y = 10; z = 1

(c) x = 5; y = 0; z =0 (d) 无变化

5.10 (a) x= 0; y = 2; z = 0; (b) x = 1; y = 2; z = 0;

5.12 8

5.13 Delhi Bangalore END

5.14

2

4

4

8

5.15 0 0 2

5.16 25

5.17 Number is negative

5.18 ABC

5.19 10

5.20 无输出

Chapter 6

6.1 √√√××√×√√×

6.2 n continue infinite indefinite-repetition-loop counter-variable

6.9 (a) 43210 (b)4321 (c)55555„55555(d)10 8

6.11 (a)无数次 x = 10; x = 5; x = 10; x = 5; x = 10;„

(b)5次 m = 3, m = 5, m = 7, m = 9, m = 11

(c)无数次, i 恒为0

(d)4次 m = 11 n = 9; m = 12 n = 11; m = 13, n = 13; m = 14, n = 15;

6.13

(a)for (n = 1; n <= 32; n = n * 2) printf("%d ", n);

(b)for (n = 1; n <= 243; n = n * 3) printf("%d ", n);

(c)for (n = -4; n <= 4; n = n + 2) printf("%d ", n);

(d) sum = 0;

for (i = 2; i <= 16; i = sum)

{

sum = sum + i;

n = n - i;

printf("%d %d %d n", i, sum, n);

}

6.16 100 90 80 70 60 50 40 30 20 10 0

6.17 m = 20时陷入死循环, 程序无输出

6.18 1

6.19 1

6.20 死循环,延长时间用

Chapter 7

7.1 √×√××√√√√××√

7.2 index/subscript run-time dynamic multi-dimensional sorting

7.14 15

7.15 HLOWRD

Chapter 8

8.1 ×√√√×√××√×××√×√

8.2 %[ a-z,A-Z] strcpy 3 stdlib gets strlen strstr strcmp s1-s2 puts

8.6 (a) The sky is the limit.

(b) The sky is

(c) T

(d) The sky is the limit

(e)84

104

101

32

115

107

121

32

105

115

32

116

104

101

32

108

105

109

105

116

(f)输出1 2 3 4 5 6 7 8 9„21这些ASCII码对应的字符,无显示符号

(g)%

(h)U

8.7 (d)

8.8 7

8.9 (a)he(b)heorshe(c)5 7

8.11 pune

Chapter 9

9.1 √×××√×××√√√×××√×√√××

9.2 actual-parameter local-variable int data-type variable-name scope recursive

static type auto

9.8 abceg

9.9 abcdeg

9.12 (a) 5 (b) 4 (c)3 (d)0

9.13 (a) 5 4 4 0 (b) 5.0 4.0 3.0 0.67

9.14 题目错,设z = 5;结果为:200 1000

9.15 100

9.16 x = 3; y = 0

Chapter 10

10.1 ×√√√√×√√×√√√××√

10.2 typedef union tag_name pointer member

Chapter 11

11.1 √×√√√√×√××

11.2 address * * 0 null


发布者:admin,转转请注明出处:http://www.yc00.com/web/1705087492a1392516.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信