一.问题及代码
/*
* 文件名称:本月有几天
* 作 者:张遥
* 完成日期:2017年3月22日
* 版 本 号:v1.0
* 对任务及求解方法的描述部分:
* 输入描述:2016年2月
* 问题描述;
* 程序输出:29天
* 问题分析:
* 算法设计:
#include<iostream>
using namespace std;
int main()
{
int year,days,mouth,temp1=1,temp2=0;
cout<<"功能:某年某月有几天"<<endl;
cout<<"请输入年份:";
cin>>year;
if(year%400==0||(year%4==0&&year%100!=0))
temp2=1;
while(temp1)
{
cout<<"请输入月份:";
cin>>mouth;
if(!(mouth>0&&mouth<13))
{
cout<<"您输入的有误"<<endl;
continue;
}
temp1=0;
}
if(mouth==2)
{
days=28;
if(temp2)
{