Skip to main content
2 of 2
golfing
anatolyg
  • 13.9k
  • 2
  • 39
  • 110

C++, 81 79 bytes

[]{for(time_t t=0,y;t<24;cout<<put_time(gmtime(&y),"%R %l:00%P\n"))y=t++*3600;}

This code requires using namespace std somewhere preceding it.

It does a loop on the values 0...23. It multiplies each value by 3600, converts to a tm struct and prints it. The print format %R outputs the 24-hour and minute; the print formats %l and %P output the proper 12-hour parts; they require GNU.

A working online version is here.

anatolyg
  • 13.9k
  • 2
  • 39
  • 110