7.11 animals.c 程序

Posted eisnull

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了7.11 animals.c 程序相关的知识,希望对你有一定的参考价值。

7.11 animals.c 程序

#include <stdio.h>
#include <ctype.h>
int main(void)
{
    char ch;
    printf("Give me a letter of the alphabet, and I will give ");
    printf("an animal name
beginning with that letter.
");
    printf("Please type in a letter; type # to end my act.
");
    while ((ch = getchar())  != '#')
    {
        if ('
'  == ch)     // 不会担心变成赋值语句
            continue;
        if (islower(ch))     /* 只接受小写字母 */
            switch (ch)
        {
            case 'a':
                   printf("argali, a wild sheep of Asia
");
                   break;
            case 'b':
                   printf("babirusa, a wild pig of Malay
");
                   break;
            case 'c':
                   printf("coati, racoonlike mammal
");
                   break;
            case 'd':
                   printf("desman, aquatic, molelike critter
");
                   break;
            case 'e':
                   printf("echidna, the spiny anteater
");
                   break;
            case 'f':
                   printf("fisher, brownish marten
");
                   break;
            default:
                   printf("That's a stumper!
");
        }            /*  switch 结束   */
        else 
            printf("I recognize only lowercase letters.
");
        while (getchar() != '
')
            continue;    /* 跳过输入行的剩余部分 */
        printf("Please type another letter or a #.
");
    }                     /*  while循环结束  */
    printf("Bye!
");
    return 0;
}

以上是关于7.11 animals.c 程序的主要内容,如果未能解决你的问题,请参考以下文章

《DSP using MATLAB》Problem 7.11

7.11随笔

安卓必备Google Play 商店 v9.7.11 官方版及特别版

Mysql5.7.11绿色版安装教程

Citrix XenApp和XenDesktop 7.11新功能

Centos7.2 Systemd 方式编译 Mysql5.7.11