/*
*Copyright (c) 2016,烟台大学计算机学院
*All rights reserved.
*文件名称:test.cpp
*作 者:刘亚
*完成日期:2016年 3月 25日
*版 本 号:1.0
*
*问题描述:本月有几天?
*输入描述:
*输出描述:
*/
#include<iostream>
using namespace std;
int main()
{
int year, month, days;
cout << "请输入年、月: ";
cin >> year >> month;
switch(month)
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
days = 31;
break;
case 4:
case 6:
case 9:
case 11:
break;
case 2:
if(year%4==0 && year%100!=0 ||year%400==0)
days = 29;
else
days =28;
}
cout<<year<<"年"<<month<<"月共有"<<days<<"天。"<<endl;
return 0;
}
*Copyright (c) 2016,烟台大学计算机学院
*All rights reserved.
*文件名称:test.cpp
*作 者:刘亚
*完成日期:2016年 3月 25日
*版 本 号:1.0
*
*问题描述:本月有几天?
*输入描述:
*输出描述:
*/
#include<iostream>
using namespace std;
int main()
{
int year, month, days;
cout << "请输入年、月: ";
cin >> year >> month;
switch(month)
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
days = 31;
break;
case 4:
case 6:
case 9:
case 11:
break;
case 2:
if(year%4==0 && year%100!=0 ||year%400==0)
days = 29;
else
days =28;
}
cout<<year<<"年"<<month<<"月共有"<<days<<"天。"<<endl;
return 0;
}