Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1567900
  • 博文数量: 354
  • 博客积分: 8137
  • 博客等级: 中将
  • 技术积分: 5137
  • 用 户 组: 普通用户
  • 注册时间: 2009-11-26 15:40
文章分类

全部博文(354)

文章存档

2010年(300)

2009年(54)

分类: C/C++

2010-06-20 19:41:57

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
    int month;
    int day;

    printf("please input the month number:");
    scanf("%d", &month);

    switch(month)
    {
        case 1:
        case 3:
        case 5:
        case 7:
        case 8:
        case 10:
        case 12: day = 31;
        break;

        case 4:
        case 6:
        case 9:
        case 11: day = 30;
        break;

        case 2:day = 28;
        break;

        default: exit(0);
    }

    printf("1999.%d has %d days.\n", month, day);
    system("pause");
    return 0;
}


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