一、單項(xiàng)選擇題(第276頁(yè))
1-5.DCDAC 6-10.CCABC 11-16.AABBB 16-20.DCDBD
二、填空題(第278頁(yè))
1.①int * ②*z
2.*p++
3.①'\0' ②++
4.①q=p+1 ②q<p+10 ③*q>max ④*q<min
三、編程題(第280頁(yè))
7.源程序:
main()
{int i=0;char c[20];
do{scanf("%s",&c);i++;}
while(strcmp(c,"stop"));
printf("%d\n",i);}
執(zhí)行結(jié)果:
This car ran form Nanyang
to Luoyang without a stop
10
9.源程序:
main()
{char s[255],c[255]={0};int i;
gets(s);
for(i=0;s[i];c[s[i++]]++);
for(i=0;i<255;i++)
if(c[i])printf("%c=%d\t",i,c[i]);}
執(zhí)行結(jié)果:
abcedabcdcd
a=2 b=2 c=3 d=3 e=1