C PRIMER PLUS(第五版)第178页7.7.2
程序代码:
#include<stdio.h>
#include<ctype.h>
int main(void)
{
char ch;
printf("Give me letter of the alphaber,and Iwill give");
printf("an animal name\nbeginning with that letter.\n");
printf("Please type in a ltter;type # to end my act.\n");
while((ch = getchar())!= '#')
{
if('\n' == ch)
continue;
if(islower(ch))
switch(ch)
{
case 'a':
printf("argali,a wild sheep of Asia\n");
break;
case 'b':
printf("babirusa,a wild pig of malay\n");
break;
case 'c':
printf("coati, racoonlike mammal\n");
break;
case 'd':
printf("deman, aquatic,moleoike critter\n");
break;
case'e':
printf("echidna,the spiny anteater\n");
break;
case 'f':
printf("fisher,brownish marten\n");
break;
default:
printf("That's a stumper!\n");
}
else
printf("I recognize only lowecase letters.\n");
while(getchar()!='\n')
continue;
printf("Please tyoe another leter or a #.\n");
}
printf("Bye!\n");
return 0;
while(getchar()!='\n')
continue;
这行我知道是跳过输入行剩余的部分,但我不理解。










