/* *Copyright (c) 2016,烟台大学计算机学院 *All rights reserved. *文件名称:test.cpp *作者: 武聪 *完成日期:2016年3月10日 *版本号:v1.0 * *问题描述: 编程序,输入年份和月份,输出本月的天数。 *输入描述:输入年份月份 *程序输出:本月天数 */ #include <iostream> using namespace std; int main() { int year,month; cin>>year>>month; if(month==2) { if(year%4==0 && year%100!=0 ||year%400==0) cout<<"本月29天"; else cout<<"本月28天"; } else if(month==1||3||5||7||8||10||12) cout<<"本月31天"; else if(month==4||6||9||11) cout<<"本月30天"; return 0; }
运行结果:
知识点总结:
判断结构的应用
学习心得:
学的不好要更努力了