Hello!
I had a task - The program requests time in the format hh: mm: ss and checks the correctness of the input.
I have created the code, but entering the example 22:22:22 shows that it is not correct, but it should show that the time is correct. Need some more testing or how to fix this?
Input time format - HH:MM:SS (<CR> to end): 22:22:22
Time format is valid
Input time format - HH:MM:SS (<CR> to end):
@coder777 >> stops extracting a number when at least one digit has been extracted and leaves the first non-digit in the stream ready for extraction and doesn't fail the stream in this case. Only if no digits can be extracted when reading a number does extraction fail the stream. When extracting from a stream, white-space is taken to be an extraction-stopping delimiter - as well as after a non-digit for a number where at least one digit has been extracted successfully.