2)NextDate函数问题 NextDate函数说明一种复杂的关系,即输入变量之间逻辑关系的复杂性
NextDate函数包含三个变量month、day和year,函数的输出为输入日期后一天的日期。
要求输入变量month、day和year均为整数值,并且满足下列条件:
条件1 1≤ month ≤12 否则输出,月份超出范围
条件2 1≤ day ≤31 否则输出,日期超出范围
条件3 1912≤ year ≤2050 否则输出:年份超出范围 String nextdate(m,d,y) 注意返回值是字符串。
程序要求: 1)先显示“请输入日期”
2)不满足条件1,返回:“月份超出范围”;不满足条件2,返回:“日期超出范围”;不满足条件3,返回:“年份超出范围”;
3)条件均满足,则输出第二天的日期:格式“****年**月**日”(如果输入2050年12月31日,则正常显示2051年1月1日) 直到输入 -1,程序退出。
#include "stdafx.h"
#include<iostream>
using namespace std;
class Date
{
int day;
int month;
int year;
public:
int Year();
int Month();
int Day(int day1,int month1,int year1);
};
int Date::Year()
{ return year; }
int Date::Month()
{ return month; }
int Date::Day(int day1;int month1;int year1);
{ if(month==1||month==3||month==5||month==7||month==8||month==10||month==12) }