Write a program to convert the time from 24-hour notation to 12-hour notation and vice versa. Your program must be menu driven, giving the user the choice of converting the time between the two notations. Furthermore, your program must contain at least the following function: 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.)
Actually, line 3 guarantees that hours will always be < 12. So get rid of line 3 as well. Line 14 does the same thing in a different way.
Lastly, if you pass hours into the function as an int, the change to hours will only be local to the function. If you want to see the change in hours in the larger program, you need to pass the variable as a reference. Try:
void convert24To12Hour(int& hours, char& pm);
as your protoype.
By the way, I disagree with @coder777 slightly in style. I would have left the function as a void function and passed both hours and pm as reference arguments. I'm not saying the @coder777 is wrong, just providing a different way of doing it.