| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 606 人关注过本帖
标题:一个书上的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
快速回复:一个书上的switch怎么在vc6上无法编译
数据加载中...
 
   



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

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