首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

编写一个Date类程序,用c++如何写

2012-03-01 
编写一个Date类程序,用c++怎么写啊跪求,程序编写题目:定义一个满足如下要求的Date类:用日/月/年的格式输出

编写一个Date类程序,用c++怎么写啊
跪求,程序编写
题目:定义一个满足如下要求的Date类:用日/月/年的格式输出日期;可运行在日期上加一天操作;设置日期操作。

[解决办法]

C/C++ code
class Date{private:    int year;    int month;    int day;public:    Date(int y, int m, int d);    void AddOne();    void SetDate(int y, int m, int d);}Date::Date(int y, int m, int d){    this.year = y;    this.month = m;    this.day = d;}Date:AddOne(){    this.day += 1;    // 这里根据天数和月份做判断}Date::SetDate(int y, int m, int d){    this.year = y;    this.month = m;    this.day = d;} 

热点排行