Write a program to accept any two dates in the form of month day year (8 23 2000)....

Write a program to accept any two dates in the form of month day year (8 23 2000)....

Write a program to accept any two dates in the form of month day year (8 23 2000), separated by spaces, and calculate the total number of days that has elapsed between the two dates, inclusive of the beginning and ending days.  Remember that leap year is a year divisible by 4, except for centennial years, which must be divisible by 400, such as 1600 or 2000 (1800 is not a leap year).  You can test your program with any typed in dates (or dates stored in a file) but it must finally run with the data shown below set up in a file. Print the output (dates and total days) on the screen. You must read in the following data from a file.

 

 Be sure to show the original dates and the days between the dates on your output.

 

DATA:                                               ANSWERS:

7 4 1776             1 1 1987             (76882)

2 1 1983             3 15 1984           (409)

7 7 1983             11 4 1983           (121)

7 3 1983             7 20 1983           (18)

12 25 1990         12 31 1992         (738)




 

Program must continue running until all the data is processed – use a loop 1 to 6 or a while (month != -1) or

while (!fin.eof()) - choose your own end of data technique.

Read the data from a defined data file – do not type in the data when the program runs.




Use if statements, switch statements, and loops to solve this problem. Do not use the Gregorian date method!




Your program must include at least four functions, not including the main method.
Powered by