0
I need solution
Military Time +50 XP You want to convert the time from a 12 hour clock to a 24 hour clock. If you are given the time on a 12 hour clock, you should output the time as it would appear on a 24 hour clock. Task: Determine if the time you are given is AM or PM, then convert that value to the way that it would appear on a 24 hour clock. Input Format: A string that includes the time, then a space and the indicator for AM or PM. Output Format: A string that includes the time in a 24 hour format (XX:XX) Sample Input: 1:15 PM Sample Output: 13:15
5 odpowiedzi
+ 2
In order to get string as input including the whitespace character, you need getline.
http://www.cplusplus.com/reference/string/string/getline/
+ 2
Hakam then just take input as string and convert parts of it to integers.
And before you ask, yes it's very much possible in C/C++.👍
+ 1
First show your attempt here 😊😍
0
I am facing only one problem with this task. I know i need to add 12hrs to the given input, then output the result. My issue is that I don't know how to define what is in the string input. If, for example, the input was an integer, it would be easier to know its value.
0
I hope someone give me the full solution code, though i didn't quite understand your answers.