得本月有几天

来源:互联网 发布:淘宝美工素材 编辑:程序博客网 时间:2024/04/29 21:11
<span style="font-size:24px;">/**copyrights(c)2014,烟台大学计算机学院*All rights reserved.*文件名称:test.cpp*作者:wangzhengqu*完成日期2014.10.17版本号:v1.0问题:本月的天数。年份year月份month*/#include <iostream>using namespace std;int main(){    int year,month;    cout<<"请输入年份\n";    cout<<"月份\n";    cin>>year;    cin>>month;    if(month==2)    {        if(year%4==0)            cout<<"本月有29天";        else cout<<"本月有28天";    }    else        switch(month)        {        case 1:        case 3:        case 5:        case 7:        case 8:        case 10:        case 12:            cout<<"本月有31天"<<endl;            break;        case 4:        case 6:        case 9:        case 11:            cout<<"本月有30天";            break;        }    return 0;}</span>
<span style="font-size:24px;"></span>
<span style="font-size:24px;"><img src="http://img.blog.csdn.net/20141022210817514?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvd2FuZ3poZW5ncXU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" /><img src="http://img.blog.csdn.net/20141022210811259?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvd2FuZ3poZW5ncXU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" /></span>

0 0