牟平-105032014138-作业1

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) }

 

转载于:https://www.cnblogs.com/m350377814/p/6531666.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值