封面
作者: PanHongliang
仅供个人学习
仅供个人学习
《 C 语言程序设计》改错信息
6页:程序的第 11-12行要与第 10 行对齐,修改如下: if(max
if(min>s[i]) min=s[i] 。
sum+=s[i] 。
、9页:图1-5用下图替换
50个,有脚80只,问鸡兔各有多少只.(用枚举法)
50个,有脚80只,问鸡兔各有多少只.(用枚举法)中的
50改为30
四、16页:第2行中 #includ改为:#inelude (原文缺少字母 e)
五、22页:将表2-6中后面一个:-38、-308、-4932中的负号(-)去掉,即下表中的红色部 分
表2-6浮点类型
类型
存储
表示范围
精度(有效位数)
float
4字节
± 3.4那0更?3.4凶0戲
7位数字
double
8字节
± 1.7 那0型8?1.7 凶O^08
16位数字
long double
10字节
± 3.4 X0竺32?3.4 XI0占32
19位数字
六、39页:将5?数学表达式sin(25° )+cos(30° )的C语言表达式为.(提示:弧度=角度X-/100.)中的
100改为180
七、75页?79页:前面程序为原文,后面程序中的红色部分是修改内容
执行下面程序:
#in clude
void mai n()
{
int a。
float b,c。
sca nf("%2d%3f%4f", &a,&b,&C.。
prin tf("\n a=%d,b=%.1f,c=%.1f\n",a,b,C.。 }
改为
执行下面程序:
#in clude
void mai n()
{
int a。
float b,c。
scanf("%2d%3f%4f",&a,&b ,&c)。
prin tf("\na=%d,b=%.1f,c=%.1f\n",a,b, c)。
}
第76页
执行下面程序:
#in clude
main()
{
int a=0,b=9 。
printf("a=%%d,b=%%d\n",a,B. 。
}
则输出结果是() . 改为
执行下面程序:
#include
main()
{
int a=0,b=9 。
printf("a=%%d,b=%%d\n",a, b) 。
}
则输出结果是() .
第 76 页
下面程序输出结果是() .
#include
void main()
{
int a=-1 。
printf("%d,%o,%u\n",a,a,A. 。
} 改为
下面程序输出结果是() .
#include
main()
{
int a=-1 。
printf("%d,%o,%u\n",a,a, a)。
}
第 76 页
0 的是()0的是()10.设 x,y,z 都是 int 型变量,且
0 的是()
0的是()
A.'x'&&'y' B.x<=y
C.x||y+z&&!yD.!(x
改为
10. 设 x,y,z 都是 int 型变量,且 x=3,y=4,z=5, 则下面表达式中值为 A.'x'&&'y' B.x<=y C.x||y+z&&!y D.!(x
15. 有如下程序
#include
void main()
{
int x=1,a=0,b=0 。
switch(x)
{
case 0: b++。
case 1: a++。
case 2: a++。 b++。
}
printf("a=%d,b=%d\n",a,B. 。
}
改为
15. 有如下程序
#include
void main()
{
int x=1,a=0,b=0 。
switch(x)
{
case 0: b++。
case 1: a++。
case 2: a++。 b++。
}
printf("a=%d,b=%d\n",a, b)。
}
第 77 页
16. 有以下程序
#include
void main()
{
int a=5, b=4, c=3, d=2 。
if(a>b>C.
printf("%d\n",D. 。
else if((c-1 >= D. == 1) printf("%d\n",d+1) 。
else printf("%d\n",d+2) 。
}
执行后输出结果是() .
B.3C.编译时出错D.
B.3
C.编译时出错D. 4
改为
16. 有以下程序
#include
void main()
{
int a=