计算一年有多少天
来源:互联网 发布:web微信开发工具linux 编辑:程序博客网 时间:2024/04/28 03:39
#include<iostream>
using namespace std;
int main()
{
int year,month,day;
int t=0;
cin>>year>>month;
if(year%400==0||(year%100!=0&&year%4==0))
t=1;
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;
}
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;
}
return 0;
}
using namespace std;
int main()
{
int year,month,day;
int t=0;
cin>>year>>month;
if(year%400==0||(year%100!=0&&year%4==0))
t=1;
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;
}
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;
}
return 0;
}
0 0
- 计算一年有多少天
- 经典SQL--求一年有多少天
- 计算这个月有多少天
- Javascript计算一年过了多少天以及星座
- C语言实现计算一年中过了多少天
- java程序一年里一个月有多少天
- 使用Calendar类得到一年中的二月有多少天
- 获取任意一年的二月有多少天
- Java--程序--获取任意一年的二月有多少天
- 计算一个月里面有多少工作日和一年中的工作日
- 计算一年有多少个周,每个周的开始日期和结束日期是什么
- 计算一年有多少个周,每个周的开始日期和结束日期是什么
- PHP计算一年有多少周,每周开始日期和结束日期
- 根据日期计算当月有多少天
- 计算某年的某月有多少天
- C#计算一个月有多少天
- 计算当前月有多少天
- 计算某一月有多少天
- 开通博客第一天
- ubuntu 14.04 无线网连接一会儿后, wifi 没掉, 但不能上网的解决方案
- 监听scroollview、listview、gridview页面滑动,判断是否滑动到顶部以及底部
- 欢迎使用CSDN-markdown编辑器
- [积累]CSS手册
- 计算一年有多少天
- hdu 5317 RGCDQ (dp+筛法)
- iOS开发之UITextView,设置textView的行间距及placeholder
- Cocos2dx.3x入门三部曲-Hello Game项目解析(三)
- Arpg 之旅
- 2010年中兴面试题
- 【游戏理论】初来乍到
- Web 开发中很实用的10个效果【附源码下载】
- 重载函数调用操作符