Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2341629
  • 博文数量: 816
  • 博客积分: 10000
  • 博客等级: 上将
  • 技术积分: 5010
  • 用 户 组: 普通用户
  • 注册时间: 2008-12-17 17:57
文章分类

全部博文(816)

文章存档

2011年(1)

2008年(815)

分类:

2008-12-17 18:05:53

[code]

//switch
#include
#include
#include

char cmd[20];

int main()
{
    gets(cmd);
    if (!strcmp(cmd,"january"))
    {
                     printf("31\n");
                     
    }
    if (!strcmp(cmd,"february"))
    {
                     printf("28\n");
                     
    }                
    if (!strcmp(cmd,"march"))
    {
                     printf("31\n");
                     
    }
    if (!strcmp(cmd,"april"))
    {
                     printf("30\n");
                     
    }
    if (!strcmp(cmd,"may"))
    {
                     printf("31\n");
                     
    }
    if (!strcmp(cmd,"june"))
    {
                     printf("30\n");
                     
    }
    if (!strcmp(cmd,"july"))
    {
                     printf("31\n");
                     
    }
    if (!strcmp(cmd,"august"))
    {
                     printf("31\n");
                     
    }
    if (!strcmp(cmd,"september"))
    {
                     printf("30\n");
                     
    }
    if (!strcmp(cmd,"october"))
    {
                     printf("31\n");
                     
    }
    if (!strcmp(cmd,"november"))
    {
                     printf("30\n");
                     
    }
    if (!strcmp(cmd,"december"))
    {
                     printf("31\n");
                     
    }
    printf("\nPress anykey to leave......");
    getch();
}

[code]

应该没有问题了

--------------------next---------------------

阅读(1155) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~