Thread: Around the Clock. Hour function ??

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    64

    Around the Clock. Hour function ??

    Hi I'm trying to make a program, which can calculate in minuts and hours.
    If I have the time 1140 and add 40 min. so It should tell me that the time = 1220, and not 1180.

    Dows anyone have a good idea how to make this work properly.

    Tx
    !G!

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > If I have the time 1140
    Split hours and minutes and calculate the time in minutes only

    m = 11 * 60 + 40

    Then add 40 to it

    Then convert back to hr:mm like so
    hr = m / 60;
    min= m % 60;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. clock program
    By bazzano in forum C Programming
    Replies: 3
    Last Post: 03-30-2007, 10:12 PM
  2. Including lib in a lib
    By bibiteinfo in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 02:28 PM
  3. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM
  4. <Gulp>
    By kryptkat in forum Windows Programming
    Replies: 7
    Last Post: 01-14-2006, 01:03 PM
  5. Question..
    By pode in forum Windows Programming
    Replies: 12
    Last Post: 12-19-2004, 07:05 PM