# C++ Question

Discussion in 'Mac Programming' started by richard4339, Sep 14, 2006.

1. ### richard4339 macrumors 6502a

Joined:
Sep 6, 2006
Location:
Illinois
#1
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?

2. ### Mitthrawnuruodo Moderator emeritus

Joined:
Mar 10, 2004
Location:
Bergen, Norway
#2
Try converting into hours and minutes (using %= 60 for the delta time and %= 100 for the "military" time) and back.

3. ### richard4339 thread starter macrumors 6502a

Joined:
Sep 6, 2006
Location:
Illinois
#3
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.