Question: Write a program called compare_dates that compares two dates and indicates which date comes earlier on the calendar. The program runs as follows: ./compare_dates where

 Write a program called compare_dates that compares two dates and indicates

Write a program called compare_dates that compares two dates and indicates which date comes earlier on the calendar. The program runs as follows: ./compare_dates where input_file is a text file that contains a single line containing a date in mm/dd/yy format. When the program runs, it prompts the user to enter a date in the same format. It then compares the date the user entered with the date in the input file and indicates which date comes earlier. For example, assume the following file called second_date.txt 5/17/07 then running ./compare_dates second_date.txt will do the following Enter date to compare to (mm/dd/yy):3/6/08 5/17/07 is earlier than 3/6/08 Note that your program should check that the two given dates are correct. That is mm is in [1,12], dd is in [1,31] according to the month (no need to handle leap years), and yy is in [2001,2019]. If either date is incorrect, output the message Wrong date format to stderr and exit the program with code 4. You must write a Makefile that compiles your source code into an executable called compare_dates . Your Makefile should have a clean target

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!