Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- class Date {
- friend const long int count_days_between_dates(const Date &, const Date &);
- friend const bool compare_dates(const Date &, const Date &);
- private:
- static const short int _firstYear = 1901; //начало времён
- short int m_year, m_month, m_day;
- const bool is_leap_year(const short int &) const;
- const short int days_in_year(const short int &) const;
- const short int days_in_month(const short int &, const short int &) const;
- void define_date(long int) const; //определение даты по кол-ву дней, начиная с 1901
- const long int count_days() const; //подсчёт дней между 1901 и данной датой
- public:
- Date();
- Date(const short int &, const short int &, const short int &);
- Date(const Date &);
- ~Date() = default;
- // long int operator-(const Date &);
- //
- // long int operator+(const Date &);
- const bool operator<(const Date &) const;
- const bool operator>(const Date &) const;
- const bool operator<=(const Date &) const;
- const bool operator>=(const Date &) const;
- const bool operator==(const Date &) const;
- const bool operator!=(const Date &) const;
- void print_date() const; //вывод даты на экран
- void set_date(const short int &, const short int &, const short int &); //изменение даты
- const bool is_leap_year() const; //идентификация високосного года
- const short int days_in_year() const; //подсчёт дней в году
- const short int days_in_month() const; //подсчёт дней в месяце
- const bool correct_date() const; //проверка правильности введёной даты
- void next_day() const; //определение следующего дня
- void previous_day() const; //определение предыдущего дня
- void future_date(long int) const; //определение будущей даты через n дней от данной даты
- void past_date(long int) const; //определение прошлой даты за n дней от данной даты
- friend void sort_dates(Date *, const int &); //сортировка массива дат
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement