View Full Version : C++ Question

Sep 14, 2006, 01:56 PM
I'm writing a C++ program to calculate wait times for an amusement park ride (assignment for class, we're preparing for a programming competition). I've looked through my references and online, and can't seem to find a good library to do this, so I wanted to know if anyone knew one I had missed.

I have an integer value in military time. I need to add an integer to it which is time in minutes, and it give me the resulting time in military time again.

IE: integer military time (0910) + 110 minutes = 1100
1304 + 450 minutes = 2034

Any ideas anyone?

Sep 14, 2006, 01:59 PM
Try converting into hours and minutes (using %= 60 for the delta time and %= 100 for the "military" time) and back. :)

Sep 14, 2006, 02:26 PM
That's what I figured I'd do if all else fails.

910 + 450 would be...

450 / 60 = number of hours
450 % 60 = number of minutes

that just leaves me with exceptions if it gets higher than 60 minutes.