I just recently started taking a C++ class so I apologize if this question is too obvious for some.
I'm working on an assignment that asks to take the user input for two different times and write a function to compute the difference between the two. I'm not having an issue with the function, but with the original input.
The solution is pretty picky on the formatting it looks for, and in this scenario its asking for:
"The prompt for the start time is:
Enter start time, in the format 'HH:MM xm', where 'xm' is
either 'am' or 'pm' for AM or PM:
The prompt for the future prompt is the same with "future" replacing "start"."
How do I take an input of say, "11:39 am" and use that for 3 different variables: int hours,int minutes and bool isAM ?
You'll need to input it as a string, and then parse it. You will have to search the array to find the space and colon, and split it, then convert the strings into their types. As an example: