当前位置:网站首页>输入年份、月份,确定天数
输入年份、月份,确定天数
2022-07-04 06:58:00 【cycy_0918】
#include<iostream>
using namespace std;
int year,month;
//年份正确
bool isRightYear(int year){
if(year>=0&&year<=9999)
return true;
return false;
}
//月份正确
bool isRightMonth(int month){
if(month>=1&&month<=12)
return true;
return false;
}
//年份是否为闰年
bool isLeapYear(int year){
if(year%400==0||(year%100!=0&&year%4==0))
return true;
return false;
}
//月份类型
int monthType(int month){
int days;
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:
days=30;break;
case 2:
if(isLeapYear(year))
{
days=29;break;
}
else{
days=28;break;
}
}
return days;
}
int main()
{
cin>>year>>month;
isRightYear(year);
isRightMonth(month);
cout<<monthType(month)<<endl;
return 0;
}
边栏推荐
- 响应式——媒体查询
- 颈椎、脚气
- Boosting the Performance of Video Compression Artifact Reduction with Reference Frame Proposals and
- Campus network problems
- Design of test cases
- Tar source code analysis Part 7
- How does the inner roll break?
- what the fuck! If you can't grab it, write it yourself. Use code to realize a Bing Dwen Dwen. It's so beautiful ~!
- tars源码分析之10
- Tar source code analysis 6
猜你喜欢
![[thread pool]](/img/de/d19897bdcfd65026cfe2a23c41b8c0.jpg)
[thread pool]

uniapp小程序分包

Vulhub vulnerability recurrence 77_ zabbix

【GF(q)+LDPC】基于二值图GF(q)域的规则LDPC编译码设计与matlab仿真

2022 where to find enterprise e-mail and which is the security of enterprise e-mail system?

notepad++如何统计单词数量

Introduction to deep learning Ann neural network parameter optimization problem (SGD, momentum, adagrad, rmsprop, Adam)

the input device is not a TTY. If you are using mintty, try prefixing the command with ‘winpty‘

Flink memory model, network buffer, memory tuning, troubleshooting

Selenium driver ie common problem solving message: currently focused window has been closed
随机推荐
Campus network problems
Google Chrome Portable Google Chrome browser portable version official website download method
Chapter 1 programming problems
How to input single quotation marks and double quotation marks in latex?
JS common time processing functions
Boosting the Performance of Video Compression Artifact Reduction with Reference Frame Proposals and
[MySQL transaction]
[Valentine's day] - you can change your love and write down your lover's name
内卷怎么破?
Download address of the official website of national economic industry classification gb/t 4754-2017
leetcode825. Age appropriate friends
电子协会 C语言 1级 35 、银行利息
Deep understanding of redis -- a new type of bitmap / hyperloglgo / Geo
leetcode825. 适龄的朋友
the input device is not a TTY. If you are using mintty, try prefixing the command with ‘winpty‘
Set JTAG fuc invalid to normal IO port
[network data transmission] FPGA based development of 100M / Gigabit UDP packet sending and receiving system, PC to FPGA
Status of the thread
MySQL 45 lecture learning notes (XIII) delete half of the table data, and the table file size remains the same
期末周,我裂开