Final answer:
A program to convert between 24-hour and 12-hour time notations requires functions for conversion, input, output, and menu display. The main function operates a loop for the user to repeatedly choose conversion options or to quit. Each conversion accounts for formatting and the addition of 'am' or 'pm' when necessary.
Step-by-step explanation:
Program to Convert Between 24-hour and 12-hour Time Notation
To write a program that converts between 24-hour and 12-hour time notation, we need to define several functions to handle the conversion, user input, and menu display. The functions are:
- A function to convert time from 24-hour notation to 12-hour notation (with 'am' or 'pm') and return the new time.
- A function to convert time from 12-hour notation to 24-hour notation and return the new time.
- A function to display the choices to the user.
- Functions to get the user input values and return them.
- Functions to display the results with each of hours, minutes, and seconds in two digits.
- The main function that calls all other functions and operates the menu loop.
The main function will continuously display the menu and prompt the user to choose an option to convert time, either from 24-hour to 12-hour or vice versa, and an option to quit the program.