第三周第二篇 本月有几天?
来源:互联网 发布:php 能和sql 编辑:程序博客网 时间:2024/05/26 12:57
/*
*Copyrigth(c)2015,烟台大学计算机学院
*All rights reserved.
*文件名称:main.cpp
*作者:汤善晔
*完成日期:2016年4月1日
*版本号:CodeBlocks12.11
*
*问题描述:编程序,输入年份和月份,输出本月有多少天。
*输入描述:输入两个数,年和月。
*程序输出:输出一个数,本月天数。
*/
#include<iostream>
using namespace std;
int main()
{
int year,month;
cin>>year;
cin>>month;
if(year%4==0&&year%100!=0||year%400==0)
{
if(month==2)
cout<<"29\n";
else if(month==1||month==3||month==5||month==7||month==8||month==10||month==12)
cout<<"31\n";
else
cout<<"30\n";
}
else
{
if(month==2)
cout<<"28\n";
else if(month==1||month==3||month==5||month==7||month==8||month==10||month==12)
cout<<"31\n";
else
cout<<"30\n";
}
return 0;
}
*Copyrigth(c)2015,烟台大学计算机学院
*All rights reserved.
*文件名称:main.cpp
*作者:汤善晔
*完成日期:2016年4月1日
*版本号:CodeBlocks12.11
*
*问题描述:编程序,输入年份和月份,输出本月有多少天。
*输入描述:输入两个数,年和月。
*程序输出:输出一个数,本月天数。
*/
#include<iostream>
using namespace std;
int main()
{
int year,month;
cin>>year;
cin>>month;
if(year%4==0&&year%100!=0||year%400==0)
{
if(month==2)
cout<<"29\n";
else if(month==1||month==3||month==5||month==7||month==8||month==10||month==12)
cout<<"31\n";
else
cout<<"30\n";
}
else
{
if(month==2)
cout<<"28\n";
else if(month==1||month==3||month==5||month==7||month==8||month==10||month==12)
cout<<"31\n";
else
cout<<"30\n";
}
return 0;
}
0 0
- 第三周第二篇 本月有几天?
- 第三周第二项目——本月有几天
- 第二周项目8-本月有几天?
- 第二周项目二本月有几天
- 第三周项目2 本月有几天?
- 第三周项目2:本月有几天
- 第三周项目2:本月有几天?
- 第三周项目二 本月有几天
- 第三周项目2:本月有几天?
- 第三周项目2本月有几天?
- 第三周项目-本月有几天?
- 第三周项目2:本月有几天?
- 第三周项目二-本月有几天?
- 第三周项目2:本月有几天?
- 第三周项目2-本月有几天?
- 第三周【项目2:本月有几天?】
- 第三周项目二本月有几天?
- 第三周 项目2-本月有几天
- iperf – 統計 jitter 以及 packet loss
- 创建POWL的实例
- 配置本地ip
- 武器类 小游戏(可操控回合制伪完整版) 怪兽类未完成
- 获取项目src下的目录
- 第三周第二篇 本月有几天?
- JavaBean
- 游戏角色纯
- 深度学习(九)caffe预测、特征可视化python接口调用
- PAT1025反转链表 (25)
- C++实验三—多分数段函数求值
- JAVA解析XML四种方式详解
- 常用方法(1)------根据图片的url路径获得Bitmap对象
- 手机web——自适应网页设计(html/css控制)