当前位置:网站首页>输入年份与月份,求该月共有多少天
输入年份与月份,求该月共有多少天
2022-06-29 20:23:00 【DianMu_DM】
x指年份,y指月份。代码不一定完善,还请大佬们多多指正。
//exam P92(3)
#include<iostream>
using namespace std;
int main()
{
int x,y;
cout<<"请输入年份:";
cin>>x;
cout<<"请输入月份:";
cin>>y;
switch (y)
{
case 1:case 3:case 5:case 7:case 8:case 10:case 12:cout<<"该月共有31天";break;
case 4:case 6:case 9:case 11:cout<<"该月共有30天";break;
case 2:if(x%4!=0)
cout<<"该月共有28天";
else cout<<"该月共有29天";break;
default:cout<<"请输入正确的月份";break;
}
return 0;
}边栏推荐
- Defense cornerstone in attack and defense drill -- all-round monitoring
- Spark存储体系底层架构剖析-Spark商业环境实战
- Analysis of the underlying architecture of spark storage system - spark business environment practice
- 2021 CCPC Harbin E. power and modulo (thinking questions)
- 【译】十二因子应用(四)
- Jupyter服务安装及启动
- How to set a pod to run on a specified node
- 【编译原理】语义分析
- 注解
- CorelDRAW2022全新版V24.1.0.360更新
猜你喜欢

How to set a pod to run on a specified node

Sentinel's quick start takes you through flow control in three minutes

苹果iPhone手机升级系统内存空间变小不够如何解决?

data link layer

Linux Installation mysql8

Regular expression series of mobile phone numbers

Real time tracking of bug handling progress of the project through metersphere and dataease

Withdrawal of user curve in qualified currency means loss

mysql中explain语句查询sql是否走索引,extra中的几种类型整理汇总

「运维有小邓」AD域委派
随机推荐
Snowflake ID, distributed unique ID
命令执行(RCE)漏洞
. NETCORE unified authentication authorization learning - first authorization (2)
fastadmin后台设置单选按钮
thinkphp5中的配置如何使用
Configuration du Flume 4 - source personnalisée + sink
Dynamics crm: among locally deployed servers, sandbox, unzip, VSS, asynchronous and monitor services
苹果iPhone手机升级系统内存空间变小不够如何解决?
Three.js开发:粗线的画法
深入Go底层原理,重写Redis中间件实战无密
Community interview -- jumpserver open source fortress in the eyes of an it newcomer
Comparable比较器写法&ClassCastExcption类转换异常
【摸鱼神器】UI库秒变低代码工具——表单篇(一)设计
Flume configuration 4 - Custom source+sink
Liunx instruction
Wangedit rich text editor usage (detailed)
雪花id,分布式唯一id
「运维有小邓」审核并分析文件和文件夹访问权限
60 days of remote office experience sharing | community essay solicitation
Finally, Amazon~