Create a program that converts time from 24-hour clock format to 12-hour clock format.
The input is a sequence of lines, each of which containing a time in 24-hour clock form, where hours and minutes are separated by a dot. The minute values are left-padded to two decimal digits with zeros.
For each line of the input, the output contains the same time in 12-hour clock format. The separator is also a dot, and the minute values are also left-padded as it was defined in the input specification. Each time before noon ends with the letters “am”, each time in the afternoon ends with the letters “pm”, and noon is displayed as “12:00pm”, while midnight is displayed as “12.00am”.
Output for Sample Input
Hints and Guide
Based on the time in 24-hour clock format, four different cases must be distinguished:
It is recommended to use the
One possible solution is available in: main.c.
Acknowledgement This work was supported by the construction EFOP-3.4.3-16-2016-00021. The project was supported by the European Union, co-financed by the European Social Fund.
|University of Debrecen; Faculty of Informatics; v. 03/01/2019|