ok i have this program dealing with date Class. im having trouble with the overloaded operator % which returns a date with smallest component month, day, and year for two given dates. your help is very appreciated.
For Example:
d1 is May 5 , 1942
d2 is August 1, 1970
The small components of d1 and d2 are May 1, 1942
class date
{
private:
int month, day, year;
bool leap; // true if a leap year
bool is_it_leap ();
public:
date (); // constructor, creates a base date
// sets a date to the given parameters
date (int m, int d, int y);
void next (); // moves a date forward one day
void print (); // prints the date in readable format
bool new_year (); // true if date is January first
// equality test for two dates
bool equal (date a_date);
// greater than test for two dates
bool operator> (date a_date);
// returns smallest components of two dates
date operator% (date a_date);
// friend that returns the greatest of three dates
friend date great3 (date d1, date d2, date d3);
};
How would my date operator% (date a_date) function definition be for it to work???