第一章
1.1 EXE
1.2 C OBJ EXE
1.3
順序
選擇
循環
?
第二章
一
.
選擇題
2.1 B 2.2 D 2.3 B 2.4 A 2.5 C 2.6 A 2.7 B
2.8 B 2.9 D 2.10 C 2.11 B 2.12 B 2.13 A
二
.
填空題
2.14 11 12
2.15 4.2 4.2
2.16 { }
定義
執行語句
2.17
關鍵字
用戶標識符
2.18 int float double
2.19 float a1=1; float a2=1;
2.20
存儲單元
2.21 3.5
2.22 (a*b)/c a*b/c a/c*b
2.23
把常量
10
賦給變量
s
2.24
位
1
或
0
2.25 8 127 0111111 -128 10000000
2.26 32767 -32768 1000000000000000
2.27 10 8 16
三
.
上機改錯題
2.28
#
i nclude "stdio.h";
刪除行尾的
";"
main(); / * main function * /
刪除
")"
后的
";",
注釋中的
*
要緊靠“
/
”
,
即應為“
/*
”和“
*/
”
函數開始處遺失了一個“
{
”
float r,s ; /*/*r is radius*/,/* s is area of circuilar*/*/
注釋符號不可嵌套使用
r = 5.0 ;
s = 3.14159 * r * r ;
printf("%f\n",s)
行尾遺失了“
;
”
函數結束處遺失了一個“
}
”
?
2.29
#
i nclude "stdio.h"
main /* main function */ main
后遺失了“
()
”
{
float a,b,c,v; /*a,b,c are sides, v is volume of cube */
a=2.0; b=3.0; c=4.0
行尾遺失了“
;
”
v=a*b*c;
printf("%f\n", v)
行尾遺失了“
;
”
}
第三章
一
.
選擇題
3.1 C 3.2 C 3.3 D 3.4 C 3.5 D 3.6 B 3.7 C 3.8 D 3.9 A 3.10 B
3.11 C 3.12 D 3.13 D 3.14 A 3.15 C 3.16 C 3.17 C 3.18
無答案
3.19 C 3.20 B
?
二
.
填空題
3.21 (1)-2002500(2)i=-200,j=2500
(3)i=-200
j=2500
3.22 12 0 0
3.23
一條語句
;
3.24 ;
3.25 100,25.81,1.89234 100 25.81 1.89234 100 25.81 1.89234
3.26 x=127,x= 127,x= 177,x= 7f,x= 127
3.27 x=127,x=127 ,x=$127 ,x=$000127,x=%06d
3.28 a=513.789215,a= 513.79,a= 513.78921500,a= 513.78921500
?
三
.
編程題和改錯題
3.29
修改后的程序如下:
main()
{
double a,b,c,s,v;
printf("input a,b,c:");
scanf("%lf%lf%lf",&a,&b,&c);
s =a*b;
v=a*b*c;
printf("a=%f,b=%f,c=%f\n", a,b,c);
printf("s=%f,v=%f\n",s,v);
}
3.30
#
i nclude
main()
{
int a=560,b=60;
printf("560 minute is %d hour and %d minute.\n",a/b,a%b);
}
3.31
#
i nclude
main()
{
int a,b;
a=1500;b=350;
printf("a div b is : %d\n",a/b);
printf("a mod b is : %d\n",a%b);
}
3.32
#
i nclude
main()
{
double a,b,c,ave;
printf ("input 3 double number : \n");
scanf ("%lf%lf%lf",&a,&b,&c);
printf ("%.1f\n",(a+b+c)/3);
}
3.33
#
i nclude
void main()
{
int a,b,c,t;
printf("
請依次輸入整數
a,b,c:");
scanf("%d%d%d",&a,&b,&c);
printf("\n
你輸入的值是
: a=%d,b=%d,c=%d\n",a,b,c);
t=b;b=a;a=c;c=t;
printf("
交換之后的值是
:a=%d,b=%d,c=%d\n",a,b,c);
}