本月有几天
2016-03-28 21:31
218 查看
/*
*烟台大学计算机与控制工程学院
*all rights reserved.
*文件名称:test.cpp
*作 者:高玉杰
*完成日期:2016年3月25日
*/
#include <iostream>
using namespace std;
int main()
{
int year,month;
int t=0;
cin>>year>>month;
if((year%4==0&&year%100!=0)||year%400==0)
t=1;
if(t==0)
{
if(month==1||month==3||month==5||month==7||month==8||month==10||month==12)
cout<<"31"<<endl;
if(month==4||month==6||month==9||month==11)
cout<<"30"<<endl;
if(month==2)
cout<<"28"<<endl;
}
if(t==1)
{
if(month==1||month==3||month==5||month==7||month==8||month==10||month==12)
cout<<"31"<<endl;
if(month==4||month==6||month==9||month==11)
cout<<"30"<<endl;
if(month==2)
cout<<"29"<<endl;
}
return 0;
}
*烟台大学计算机与控制工程学院
*all rights reserved.
*文件名称:test.cpp
*作 者:高玉杰
*完成日期:2016年3月25日
*/
#include <iostream>
using namespace std;
int main()
{
int year,month;
int t=0;
cin>>year>>month;
if((year%4==0&&year%100!=0)||year%400==0)
t=1;
if(t==0)
{
if(month==1||month==3||month==5||month==7||month==8||month==10||month==12)
cout<<"31"<<endl;
if(month==4||month==6||month==9||month==11)
cout<<"30"<<endl;
if(month==2)
cout<<"28"<<endl;
}
if(t==1)
{
if(month==1||month==3||month==5||month==7||month==8||month==10||month==12)
cout<<"31"<<endl;
if(month==4||month==6||month==9||month==11)
cout<<"30"<<endl;
if(month==2)
cout<<"29"<<endl;
}
return 0;
}
相关文章推荐
- uestc1134男神的约会【状压dp】
- File 类
- [置顶] 未知图片宽高水平垂直居中
- D17
- iOS文件操作学习3-28
- 求四个数的最大公约数
- ehcache memcache redis三大缓存男高音
- AndroidStudio项目提交(更新)到github最详细步骤
- 第五周项目1 三角形类练习(4)
- Collections工具类下的sort方法
- dfs
- 排序算法之归并排序(Java)
- 【java web】--Jsp与beetl的前世今缘
- 求两个数的最大公约数
- 排序算法之快速排序(Java)
- JAVA继承特点的小总结
- AQTime教程
- 对关于iOS图片压缩的一点积累
- java 各种排序算法实现
- Material Design 笔记