文件名称:riqi
介绍说明--下载内容均来自于网络,请自行研究使用
自定义一个简单的日期类DateType,它具有数据成员y、m、d,用来表示当前日期的年、月、日。而后设计该类欲实现(完成)的功能,进而设计出相应的类成员函数。
例如,下面给出的“雏形”可用来实现对天的增加,比较两个日期是否相等,以及对日期的输出等操作。请完成各类成员函数,并编制主函数,说明DateType类对象,对定义的各成员函数进行调用,以验证它们的正确性。
class DateType { //自定义的日期类DateType
int y,m,d //数据成员,表示当前日期的年、月、日
public:
DateType(int y0=1, int m0=1, int d0=1)
//构造函数,设定年、月、日;并设置参数默认值
void incrementDay() //增加1天
bool equal(DateType dt2) //判断二日期是否相等
void printDate() //屏幕输出日期对象的有关数据(年、月、日)
}
-from the simple definition of a category DateType date, it has data members y, m, d, said the date for the current year, month, day. Then the design of such wishes to achieve (completed) function, and then design the class member functions. For example, the following is a "prototype" can be used to achieve the increase in the days to compare the same date. and the date of the export operation. Please complete the various members function, and the preparation of the main function, note DateType type object, definition of the members of the function call to verify their accuracy. Class DateType (/ / define the date category DateType int y, m, d / / data members, said the date of the current year, month, day public : DateType (int y0 = 1, m0 = 1 int, int d002 = 1) / / constructor fu
例如,下面给出的“雏形”可用来实现对天的增加,比较两个日期是否相等,以及对日期的输出等操作。请完成各类成员函数,并编制主函数,说明DateType类对象,对定义的各成员函数进行调用,以验证它们的正确性。
class DateType { //自定义的日期类DateType
int y,m,d //数据成员,表示当前日期的年、月、日
public:
DateType(int y0=1, int m0=1, int d0=1)
//构造函数,设定年、月、日;并设置参数默认值
void incrementDay() //增加1天
bool equal(DateType dt2) //判断二日期是否相等
void printDate() //屏幕输出日期对象的有关数据(年、月、日)
}
-from the simple definition of a category DateType date, it has data members y, m, d, said the date for the current year, month, day. Then the design of such wishes to achieve (completed) function, and then design the class member functions. For example, the following is a "prototype" can be used to achieve the increase in the days to compare the same date. and the date of the export operation. Please complete the various members function, and the preparation of the main function, note DateType type object, definition of the members of the function call to verify their accuracy. Class DateType (/ / define the date category DateType int y, m, d / / data members, said the date of the current year, month, day public : DateType (int y0 = 1, m0 = 1 int, int d002 = 1) / / constructor fu
(系统自动生成,下载前可以参看下载内容)
下载文件列表
压缩包 : 39709560riqi.rar.zip 列表 基础题22(改进).cpp 基础题22.cpp