第1章
1选择题
(1) C (2) B (3) D
2填空题
(1)main (2) main (3) 有穷性、确定性、有零个或多个输入、有一个或多个输出、有效性
(4) 顺序、分支和循环(5) 自顶向下,逐步细化、模块化设计、结构化编码
第2章
1选择题
BBCDA DDBBA BBDCB
2、填空题
(1) 数字、字母、下划线 (2)0 (3) 4、8 (4) (a+b)*c/(a-b) (5) -60 6-16
73 86、4、2 90 1010、6 115.500000 12 12、4
13double 14 0 1516 166.6
3、编程题
1
main()
{
printf("int:%5d\n"
"float:%5d\n"
"char:%5d\n"
"double:%5d\n"
"long:%5d\n",
sizeof(int),+-
sizeof(float),
sizeof(char),
sizeof(double),
sizeof(long));
}
2
#define RAT 1.60934
main()
{
float k=0.0;
printf("input the km:");
scanf("%f",&k);
printf("\nmile:%f",k*RAT);
}
第3章
1选择题
(1)~(10):DDCDCDCDBC
2解析题
(1) x=170,x=ㄩㄩㄩ170,x=ㄩㄩㄩ252, x=ㄩㄩㄩ170
x=170,x=170ㄩㄩㄩ,x=ㄩㄩㄩ170,x=%6d a=513.789185,a=ㄩㄩ513.79,a=513.78918457,a=513.78918457
(2) a=3ㄩb=7x=8.5ㄩy=71.82c1=Aㄩc2=a
3编程题
(1)
main()
{
int x,y;
scanf("%d%d",&x,&y);
printf("商数=%d,余数=%d",x/y,x%y);
system("pause");
}
(2)
main()
{
double x,y,z,avg;
scanf("%lf%lf%lf",&x,&y,&z);
avg=(x+y+z)/3;
printf("%.1lf",avg,avg);
system("pause");
}
第4章
1选择题
(1)(10) CCAADCCABD
2填空题
(1) ch>='A' && ch<='Z' ch=ch-32
(2) x<=10 && x>2 x<=2 && x>-1 y=-1
(3) a+b>c && a+c>b && b+c>a a==b&&a==c a==b || a==c || b==c
(4) mark/10 k=1 case 9
(5) x<0 c=x/10 y!=-2
3编程题
(1)
#include
main()
{
int x;
printf("please input a number:");
scanf("%d",&x);
if(x%2==0) printf("x is a even number");
else printf("x is a odd number");
}
(2)
#include
main()
{ int x,y;
printf("please input a numbero");
scanf("%d",&x);
if(x<=-5) printf("the number is error");
else if(x<0) {y=x; printf("%d",y);}
else if(x==0) {y=x-1;printf("%d",y);}
else if(x<10) {y=x+1;printf("%d",y);}
else printf("the number is error");
}
(3)
#include
main()
{ int a,m;
printf("please input a number:");
scanf("%d",&a);
switch(a/10)
{ case 0:
case 1:
case 2:m=1;break;
case 3:m=2;break;
case 4:m=3;break;
case 5:m=4;break;
default:m=5;break;
}
printf("%d",m);
}
(4)
#include
main()
{
float price,tax;
printf("please input the price of product:");
scanf("%f",&price);
if(price>10000) tax=price*0.05;
else if(price>5000) tax=price*0.03;
else if(price>1000) tax=price*0.02;
else tax=0;
printf("%f",tax);
}
(5)
#include
main()