| Lexington High School Mathematics | Math Dept. Front Page | Student Links | Family Links |
| Introduction to C++, Kevin Kelly | Kelly Front Page | C++ Course Guide | C++ Assignments | C++ Info |
Write a function
bool later (DATE date1, DATE date2)that compares two dates, and returns true if the second date is later than the first, false otherwise.
The data type DATE should be defined using the following struct statement:
struct DATE
{
int month, day, year;
};
Also write a main program that tests your function.
You may choose your own values for sample runs, but you must show an example of
each possible situation (for example, one situation would be that both dates are in
the same month and year). Your grade will be partly based on your choosing a set of
sample values that is sufficient to demonstrate that your program handles all cases correctly.
Original idea for this problem: Litvin and Litvin, "C++ for You" workbook, page 32.
DATE laterdate (DATE date1, DATE date2)that returns the later of the two dates. Test this function using the same set of sample values as you used for the first program.