/*
*copyright(c) 2014,烟台大学计算机学院
*All rights reserved
*文件名称:test.cpp
*作者:吴雨凡
*版本:v6.0
*
*问题描述:输入月份,判断有几天
*输入描述:月份
*程序输出:判断相关问题
*/
#include <iostream>
using namespace std;
int main()
{
int year, month;
cout << "请输入年、月: ";
cin >> year >> month;
if(year%4==0 && year%100!=0 ||year%400==0)
{
switch(month)
{
case 1:cout<<"本月31天";break;
case 2:cout<<"本月28天";break;
case 3:cout<<"本月31天";break;
case 4:cout<<"本月30天";break;
case 5:cout<<"本月31天";break;
case 6:cout<<"本月30天";break;
case 7:cout<<"本月31天";break;
case 8:cout<<"本月31天";break;
case 9:cout<<"本月30天";break;
case 10:cout<<"本月31天";break;
case 11:cout<<"本月30天";break;
case 12:cout<<"本月31天";break;
}
}
else
switch(month)
{
case 1:cout<<"本月31天";break;
case 2:cout<<"本月29天";break;
case 3:cout<<"本月31天";break;
case 4:cout<<"本月30天";break;
case 5:cout<<"本月31天";break;
case 6:cout<<"本月30天";break;
case 7:cout<<"本月31天";break;
case 8:cout<<"本月31天";break;
case 9:cout<<"本月30天";break;
case 10:cout<<"本月31天";break;
case 11:cout<<"本月30天";break;
case 12:cout<<"本月31天";break;
}
}