标题:一个书上的switch怎么在vc6上无法编译
取消只看楼主
於藤
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2012-3-2
结帖率:100%
已结贴  问题点数:20 回复次数:2 
一个书上的switch怎么在vc6上无法编译
一个书上的switch语句,在vc下总是无法编译,麻烦帮我看看
#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\nbeginning with that letter.\n");
    printf("please type in a letter: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("desman,aquatic, molelike.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 lowercase letters.\n");
        while(getchar()!'\n')
            printf("Please type another letter or a #.\n");
    }
    printf("Bye!\n");
    return 0;
}
搜索更多相关主题的帖子: continue include please animal letter 
2012-07-14 13:39
於藤
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2012-3-2
得分:0 
回复 2楼 TonyDeng
xx.exe - 1 error(s), 0 warning(s)
2012-07-14 14:00
於藤
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2012-3-2
得分:0 
回复 4楼 TonyDeng
xie xie
2012-07-14 14:07



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-373369-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.158136 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved