Hi. I'm trying to create a program that will give the duration between two different times. The times are read in from a text file and are in the form "9:00", "11:00", "15:30", "17:00", etc. I am trying to work out how I'd do this.
The only thing I can think of is making the time an int, but that would cause problems due to the : in the middle of the number. Is there a way to remove the : when reading in the text file, and then add it back in before giving the output? Because if the two times were 9:00 and 11:00, by completing 1100 - 900, I could get 200, which with the : added back in would give 2:00. The only problem I forsee is when the number of minutes is not 0, because 1100 - 930 would give 170, not 130.
If anyone can make sense of my rambling and give me a hand, it would be much appreciated. Thanks in advance!