当前位置:网站首页>输入年份、月份,确定天数
输入年份、月份,确定天数
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;
}
边栏推荐
- Analysis of tars source code 5
- 云Redis 有什么用? 云redis怎么用?
- centos8安装mysql.7 无法开机启动
- MySQL 45 lecture learning notes (XIV) count (*)
- 高薪程序员&面试题精讲系列119之Redis如何实现分布式锁?
- 电子协会 C语言 1级 35 、银行利息
- selenium IDE插件下载安装使用教程
- [MySQL transaction]
- Selection (022) - what is the output of the following code?
- How does the inner roll break?
猜你喜欢

Review of enterprise security incidents: how can enterprises do a good job in preventing source code leakage?

The crackdown on Huawei prompted made in China to join forces to fight back, and another enterprise announced to invest 100 billion in R & D
![[thread pool]](/img/de/d19897bdcfd65026cfe2a23c41b8c0.jpg)
[thread pool]

How to share the source code anti disclosure scheme

Vulhub vulnerability recurrence 77_ zabbix

Su Weijie, a member of Qingyuan Association and an assistant professor at the University of Pennsylvania, won the first Siam Youth Award for data science, focusing on privacy data protection, etc

Knowledge payment applet dream vending machine V2

Cervical vertebra, beriberi

Can the out of sequence message complete TCP three handshakes

移动适配:vw/vh
随机推荐
what the fuck! If you can't grab it, write it yourself. Use code to realize a Bing Dwen Dwen. It's so beautiful ~!
Design of test cases
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
The final week, I split
2022 wechat enterprise mailbox login entry introduction, how to open and register enterprise wechat enterprise mailbox?
Tar source code analysis 9
tars源码分析之6
MySQL 45 lecture learning notes (VI) global lock
The cloud native programming challenge ended, and Alibaba cloud launched the first white paper on application liveliness technology in the field of cloud native
What is industrial computer encryption and how to do it
tars源码分析之10
Background and current situation of domestic CDN acceleration
Download address of the official website of national economic industry classification gb/t 4754-2017
Review of enterprise security incidents: how can enterprises do a good job in preventing source code leakage?
How does the recv of TCP socket receive messages of specified length?
BasicVSR++: Improving Video Super-Resolutionwith Enhanced Propagation and Alignment
Finishing (III) - Exercise 2
kubernetes集群之Label管理
Deep profile data leakage prevention scheme
2022, peut - être la meilleure année économique de la prochaine décennie, avez - vous obtenu votre diplôme en 2022? Comment est - ce prévu après la remise des diplômes?