You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
788 B
31 lines
788 B
#pragma once
|
|
#ifndef DATE_H
|
|
#define DATE_H
|
|
#include <iostream>
|
|
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
|