#include "stdafx.h"
#include
using namespace std;
class Date{
public:
int year;
int month;
int day;
Date(int x, int y, int z)
{
year = x;
month = y;
day = z;
}
~Date()
{
}
};
class DateTime:public Date
{
public:
int h;
int min;
int s;
DateTime(int x, int y, int z, int o, int p, int q) :Date(x,y,z)
{
h = o;
min = p;
s = q;
}
~DateTime()
{
}
DateTime &operator++(int)
{
year += 0;
month += 0;
day += 0;
h += 0;
min += 0;
s++;
return *this;
}
};
int _tmain(int argc, _TCHAR* argv[])
{
DateTime A(2016, 5, 26, 18, 4, 20);
while (1)
{
char B;
cout << "请输入‘+’符号实现加一秒的操作或输入其他退出程序" << endl;
cin >> B;
if (B == '+')
{
A++;
cout << A.year << ' ' << A.month << ' ' << A.day << ' ' << A.h << ' ' << A.min << ' ' << A.s << endl;
}
else return 0;
}
return 0;
}