Take a look at the time functions in the header <ctime> (or the C library header <time.h>). Using the functions available in that header, the program you need to write should be pretty straight forward. Have a go, and if you get stuck post your code here for help.