当前位置: 首页 > news >正文

今年过去了多少天?(switch)

//今年已经过去了几天?
#include <stdio.h>
int monthday(int year,int month){switch(month){case 1:return 31;case 2:if ((year % 4 == 0 && year % 100 != 0)||year % 400 == 0){return 29;}else{return 28;}break;case 3:return 31;case 4:return 30;case 5:return 31;case 6:return 30;case 7:return 31;case 8:return 31;case 9:return 30;case 10:return 31;case 11:return 30;case 12:return 31;default:return 0;}
}
int main(){int year,month,day;scanf("%d %d %d",&year,&month,&day);int i=1;int sum=day;for(i=1;i<=month;i++){sum+=monthday(year,i-1);}if(sum==1){printf("So far 1 day");}else{printf("So far %d days",sum);}
}

http://www.lryc.cn/news/333740.html

相关文章:

  • 提升团队工程交付能力,从“看见”工程活动和研发模式开始
  • 前端学习之DOM编程案例:全选反选案例
  • golang map
  • 设计模式:享元模式案例
  • pandas(day5)
  • 如何注册midjourney账号
  • 探索数据结构:特殊的双向队列
  • 16_I2C库函数
  • 十八、Rust gRPC 多 proto 演示
  • 【Linux】Linux64位环境下编译32位报错skipping incompatible的解决办法
  • vue指令v-model
  • CentOS安装MySQL数据库
  • 从B2B转向B2B2C模式:工业品牌史丹利百得的转型历程
  • Redis群集模式和rsync远程同步
  • JAVA—抽象—定义抽象类Converter及其子类WeightConverter
  • 面对复杂多变的网络攻击,企业应如何守护网络安全
  • 计算机网络练习-计算机网络概述与性能指标
  • vite vue3 ts import.meta在vscode中报错
  • Java synchronized(详细)
  • 算法设计与分析实验报告python实现(排序算法、三壶谜题、交替放置的碟子、带锁的门)
  • 实训问题总结——ajax用get可以成功调用controller方法,用POST就出404错误
  • 1、认识MySQL存储引擎吗?
  • 微信小程序媒体查询
  • 前端(动态雪景背景+动态蝴蝶)
  • 软考-系统集成项目管理中级-新一代信息技术
  • 【卷积神经网络进展】
  • yarn的安装和使用
  • Golang | Leetcode Golang题解之第10题正则表达式匹配
  • 【Leetcode】top 100 图论
  • 【沈阳航空航天大学】 <C++ 类与对象计分作业>