Listing 10 A test for version 3 of the Date class

// tdate3. cpp
#include <stdio.h>
#include <stdlib.h>
#include "date3.h"
main()
{
   int m, d, y, nargs;
   
   // Read in two dates - assume 1st precedes 2nd
   fputs("Enter a date, MM/DD/YY> ",stderr);
   nargs = scanf("%d/%d/%d%*c", &m,&d,&y);
   if (nargs != 3)
      return EXIT_FAILURE;
   Date d1(m,d,y);
   
   fputs("Enter a later date, MM/DD/YY> ",stderr);
   nargs = scanf("%d/%d/%d%*c", &m,&d,&y);
   if (nargs != 3)
      return EXIT_FAILURE;
   Date d2(m,d,y);
   
   // Compute interval in years, months, and days
   Date *result = d1.interval(d2);
   printf("years: %d, months: %d, days: %d\n",
      result->get_year (),
      result->get_month (),
      result->get_day ());
   return EXIT_SUCCESS;
}
/* End of File */