第三周项目:本月有几天?
2016-04-05 20:37
357 查看
#include<iostream> using namespace std; int main() { i 4000 nt year, month, days; cout << "请输入年、月: "; cin >> year >> month; if(year%4==0 && year%100!=0 ||year%400==0) { 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: days = 29; } } else { 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: days =28; } } cout<<year<<"年"<<month<<"月共有"<<days<<"天。"<<endl; return 0; }
<img src="https://img-blog.csdn.net/20160405203656688?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
相关文章推荐
- 使用Gson将json字符串转为map
- Selective Search for Object Recoginition
- 第6周项目4—静态成员的函数
- TimesTen数据库的备份和恢复
- struts2图片文件上传经验总结
- 我的程序之路
- 第五周 项目1(5)
- c++二叉树的各种遍历
- 两个序列组合成最大的数Create Maximum Number
- 先立好flag
- POJ-1840 Eqs
- 2009年清华大学计算机研究生机试真题
- Spring中@ImportResource和@Value加载资源文件
- Java第五次实验要求
- Android给一组控件设置StateListDrawable
- DAO层最好带上try和catch
- 【转】kinect和openNI学习资料汇总
- <<unix/linux programming>>学习标记整理
- 【codevs 1369】题解
- 第六周项目二带武器角色类