当前位置:网站首页>输入年份、月份,确定天数
输入年份、月份,确定天数
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;
}
边栏推荐
- Mysql 45讲学习笔记(十二)MySQL会“抖”一下
- 【GF(q)+LDPC】基于二值图GF(q)域的规则LDPC编译码设计与matlab仿真
- Knowledge payment applet dream vending machine V2
- Selenium ide plug-in download, installation and use tutorial
- Responsive mobile web test questions
- leetcode825. 适龄的朋友
- MySQL relearn 2- Alibaba cloud server CentOS installation mysql8.0
- 响应式移动Web测试题
- MySQL storage engine
- Mobile adaptation: vw/vh
猜你喜欢

the input device is not a TTY. If you are using mintty, try prefixing the command with ‘winpty‘
![[GF (q) + LDPC] regular LDPC coding and decoding design and MATLAB simulation based on the GF (q) field of binary graph](/img/5e/7ce21dd544aacf23b4ceef1ec547fd.png)
[GF (q) + LDPC] regular LDPC coding and decoding design and MATLAB simulation based on the GF (q) field of binary graph

what the fuck! If you can't grab it, write it yourself. Use code to realize a Bing Dwen Dwen. It's so beautiful ~!

Recursive Fusion and Deformable Spatiotemporal Attention for Video Compression Artifact Reduction

Splicing plain text into JSON strings - easy language method
![[number theory] fast power (Euler power)](/img/1e/5d032c8f2e43f553b4543d28ea2a2d.jpg)
[number theory] fast power (Euler power)

Cervical vertebra, beriberi

Uniapp applet subcontracting

《剑指Offer》第2版——力扣刷题

Selenium ide plug-in download, installation and use tutorial
随机推荐
If there are two sources in the same job, it will be reported that one of the databases cannot be found. Is there a boss to answer
BasicVSR++: Improving Video Super-Resolutionwith Enhanced Propagation and Alignment
Tar source code analysis 6
Analysis of tars source code 1
What is a spotlight effect?
The important role of host reinforcement concept in medical industry
Data double write consistency between redis and MySQL
tars源码分析之5
响应式——媒体查询
tars源码分析之8
tars源码分析之4
NLP-文献阅读总结
Bottom problem of figure
电子协会 C语言 1级 34 、分段函数
《国民经济行业分类GB/T 4754—2017》官网下载地址
tcp socket 的 recv 如何接收指定长度消息?
Check and display one column in the known table column
Fundamentals of SQL database operation
The difference between synchronized and lock
内卷怎么破?