rilibiao

来源:互联网 发布:异能事务所网络电影 编辑:程序博客网 时间:2024/05/16 09:05
上机目的;对分支结构加深理解,练习01.* Copyright (c) 2012, 烟台大学计算机学院    02.   03.* All rights reserved.   04.   05. * 作 者;袁静    06.   07.* 完成日期:2012 年 10月27 日    08.   09.* 版 本 号:v1.0    10.   11.* 输入描述:输入的是年份和月份  12.*问题描述:#include <iostream>using namespace std;int main(){int year ,month;cout <<"请输入年,月:";cin>>year>>month;if (month==1||month==3||month==5||month==7||month==8||month==10||month==12)cout<<"本月有31天:";else if (month==4||month==6||month==9||month==11)cout<<"本月有30天:";if(year%4==0&&year%100!=0||year%400==0)    //判断输入的年份是否为闰年   {if(month=2)cout<<"本月有29天:";}    else if(month=2)cout<<"本月有28天:";            //平年二月份有28天    return 0;}

原创粉丝点击