I urge you to re-read the assignment. In particular, this part:
your program must contain at least the following functions: a function to convert the time from 24-hour notation to 12-hour notation, a function to convert the time from 12-hour notation to 24-hour notation, a function to display the choices, function(s) to get the input, and function(s) to display the results. (For 12-hour time notation, your program must display AM or PM). |
Your current military() and regular() functions read the input, do the conversion and write the output, all in one function.
Before writing the code, you should think about these functions. Write down what each one will be called, what it's parameters and return values are, and exactly what each one will do. Then go through them and try to convince yourself that the program will work with these functions. Here's a hint: it probably won't the first time through. So things until you're pretty sure that it will work.
You can and should do all of this without writing a single line of code. At this point you're designing the code.
Now it's time to write your code. I'd start with the code that displays the time. Write that function (functions) and then create a main program that tests them out. Get this code working.
Now add code to convert between the formats. Modify your main program to call each of these with some different values. Test it until it works.
Finally, write the code that displays the menu and gets the input.
By writing the code in small steps like this, you can concentrate on one part of the code at a time. If you try to write the whole thing at once, then you'll just get lost, as you've discovered.