1st parameter represents the month number (1-12)
2nd parameter represents the day of month, day must be valid based on the month.
3rd parameter represents the years:
( if the year is between 0 and 99, its valid;
if the year is between 1800 and 2030, it is valid;
if the year is between 0 and 29, store it as 2000-2029;
if the year is between 30 and 99, store it as 1930-1999)
Here's my coding so far:
Expand|Select|Wrap|Line Numbers
- #include <iostream>
- using namespace std;
- class MyDate
- {
- private:
- int Month;
- int Day;
- int Year;
- public:
- int getMonth()
- {
- return Month;
- }
- int getDay()
- {
- return Day;
- }
- int getYear()
- {
- return Year;
- }
- void set(int Month_param, int Day_param, int Year_param)
- {
- Month = Month_param;
- Day = Day_param;
- Year = Year_param;
- }
- };
- int main()
- {
- return 0;
- }