time counter
-
I am writing a program where two different times in a day are giving and the program will solve how many hour and how many minutes. For example: input start time input end time output duration or input 5:30 input 6:40 output 1 hour 10 minutes can anybody help me?
-
I am writing a program where two different times in a day are giving and the program will solve how many hour and how many minutes. For example: input start time input end time output duration or input 5:30 input 6:40 output 1 hour 10 minutes can anybody help me?
What have you written so far ?
Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
-
I am writing a program where two different times in a day are giving and the program will solve how many hour and how many minutes. For example: input start time input end time output duration or input 5:30 input 6:40 output 1 hour 10 minutes can anybody help me?
Compare the hour value and use the bigger hour minus the smaller hour, let this be h. If both are the same hour, just subtract the minutes. Next, use the minutes from the "bigger" hour to minus the minutes from the "smaller" hour, let this be m. If the m is negative, subtract 1 from the h, and add 60 to m.