The program I've written is a 24-hour clock that converts inputed time in to a 12-hour clock. My issue is that I can't get the program to show whether the time converted is am or pm. It sounds simple enough but I'm restricted to doing it a certain way, because this is a school assignment. In the second function (convertTime24to12) the data going out of the function needs to consist of the hour in 12-hour format and the a.m. or p.m. stored as a char, 'a' for a.m. or 'p' for p.m. This function should not output the results to the screen, instead it should send the results back to the caller (by value or call-by-reference).
I got the time conversion part, my troubles are with storing the a.m. p.m. as characters and then calling them back out in latter functions to output "a.m." or "p.m." after the the displaying the time.
Can someone point me in the right direction because I've tried so many things and I'm left clueless as to what I need to do.
In the second function (convertTime24to12) the data going out of the function needs to consist of the hour in 12-hour format and the a.m. or p.m. stored as a char, 'a' for a.m. or 'p' for p.m.
The function needs to return more than one value. There are a number of ways to do this, such as using a struct or a std::pair<int, char>, or passing parameters by reference.
In fact, you are already passing the hour by reference. You just need a second parameter.