John A
Vampirical Lurker
7,630 posts since Apr 2006
Reputation Points: 2,240
Solved Threads: 339
>>I think I will have to use a formula that will divide the number of seconds into hours, seconds into minutes, and the remainder will be seconds.
Yup, pretty close. You can use division, modulo, and/or subtraction in sequence to do what is needed.
NumberOfHours is InputSeconds divided by NumberOfSecondsInHour. Since this will be integer division there won't be any decimal point remainder.
After determining NumberOfHours, then you can determine the remaining seconds as follows: RemainingSeconds equals the remainder of InputSeconds divided by NumberOfSecondInHour (in C and C++ the remainder of a division involving two int variables can be obtained by using the modulo operator. So if num = 5 % 2, then num equals 1 since 1 is the remainder of 5 divided by 2) OR, if you don't want to use the modulo operator you could use RemainingSeconds equals InputSeconds minus the product of NumberOfHours times NumberOfSecondsInHour.
You can do a similar type formula for determining number of minutes.
Lerner
Nearly a Posting Maven
2,382 posts since Jul 2005
Reputation Points: 739
Solved Threads: 396