fork download
  1. struct time
  2. {
  3. int hour, minutes, seconds;
  4. };
  5.  
  6. struct date
  7. {
  8. int month, day, year;
  9. };
  10.  
  11. struct date_and_time
  12. {
  13. struct date sdate;
  14. struct time stime;
  15. };
  16.  
  17. #include <stdio.h>
  18. int main ()
  19. {
  20. struct date_and_time event =
  21. {
  22. {2,1,1988}, // date - month, day, year
  23. {3,30,0} // time - hour, minutes, seconds
  24. };
  25.  
  26. event.sdate.month = 10;
  27.  
  28. ++event.stime.seconds;
  29.  
  30. printf ("\nDate: \t %i/%i/%i\n",
  31. event.sdate.month,
  32. event.sdate.day,
  33. event.sdate.year);
  34.  
  35. printf ("Time:\t %i hour(s) %i minute(s) %i second(s)\n",
  36. event.stime.hour,
  37. event.stime.minutes,
  38. event.stime.seconds);
  39.  
  40. return (0);
  41.  
  42. } // main
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
Date: 	 10/1/1988
Time:	 3 hour(s) 30 minute(s) 1 second(s)