diff --git a/date.h b/date.h new file mode 100644 index 0000000..f8ec692 --- /dev/null +++ b/date.h @@ -0,0 +1,31 @@ +#pragma once +#ifndef DATE_H +#define DATE_H +#include +using namespace std; + +class Date +{ +private: + int year; + int month; + int day; +public: + Date() { year = 0; month = 0; day = 0; } + Date(int y, int m, int d) { year = y; month = m; day = d; } + Date(Date& d) { year = d.year; month = d.month; day = d.day; } //³õʼ»¯ + ~Date() { }; + void setYear(int y) { year = y; } + void setMonth(int m) { month = m; } + void setDay(int d) { day = d; } + int getYear() { return year; } + int getMonth() { return month; } + int getDay() { return day; } + void inputDate() { + cout << "year£º "; cin >> year; + cout << "month£º "; cin >> month; + cout << "day£º "; cin >> day; + } + void displayDate() { cout << year << "-" << month << "-" << day << endl; } +}; +#endif //DATE_H \ No newline at end of file