Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "d_date.h"
- #include <stdexcept>
- #include <iostream>
- using namespace std;
- bool date::operator< (const date& date1) const {
- return (year < date1.year && month < date1.month && day < date1.day);
- }
- bool date::operator> (const date& date1) const {
- return (year > date1.year && month > date1.month && day > date1.day);
- }
- date date::operator++ (){
- date temp = *this;
- temp.incrementDate(1);
- return temp;
- }
- ostream& operator<<(ostream& ostr, const date& date1){
- ostr << date1.getDay() << "/" << date1.getMonth() << "/" << date1.getYear() << " ";
- return ostr;
- }
- //istream& operator>>(istream& istr, date& date1){
- istream& operator>>(istream& istr, date& date1){
- int d, m, y;
- char ch;
- istr >> d >> ch >> m >> ch >> y >> ch;
- date1.setDay(d);
- date1.setMonth(m);
- date1.setYear(y);
- return istr;
- }
- bool operator== (const date& date1, const date& date2) {
- return (date2.getDay() == date1.getDay() && date2.getMonth() == date1.getMonth() && date2.getYear() == date1.getYear());
- }
- bool operator!= (const date& date1, const date& date2){
- return !(date1 == date2);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement