Thread: sutracting 24 hour time

  1. #1
    Registered User
    Join Date
    Nov 2003
    Posts
    5

    sutracting 24 hour time

    I need to construct a ‘C’ program that subtracts one time from another. The times are expressed in terms of a number of hours and a number of minutes and are in 24-hour format. For example, subtracting 1 hour 30 minutes from 1 hour 0 minutes (representing 01:00) should result in 23:30 being displayed (i.e. 11:30pm the previous day). The user will enter four values (the hours and minutes of each of the two times) and the program should then output the result of the subtraction in 24-hour format.

    Any help will be much appreciated

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    No one is going to do your homework for you. Post your attempt and what you're having problems with. While you're at it, read the forum rules at the top of the forum.

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Nov 2003
    Posts
    5
    would i need to change all times into minutes first and work from there or will i keep them in hours. also would i need to use floor

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    > would i need to change all times into minutes first and work from there or will i keep them in hours
    Either will work, though I suspect one will be easier than the other.

    But as you said, "I need to construct a ‘C’ program"
    You DO
    We advise, suggest, correct, hint, explain
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Execution Time - Rijandael encryption
    By gamer4life687 in forum C++ Programming
    Replies: 5
    Last Post: 09-20-2008, 09:25 PM
  2. Time to seconds program
    By Sure in forum C Programming
    Replies: 1
    Last Post: 06-13-2005, 08:08 PM
  3. Killing someones grandparents
    By nickname_changed in forum A Brief History of Cprogramming.com
    Replies: 37
    Last Post: 09-07-2003, 07:56 AM
  4. The Timing is incorret
    By Drew in forum C++ Programming
    Replies: 5
    Last Post: 08-28-2003, 04:57 PM
  5. relating date....
    By Prakash in forum C Programming
    Replies: 3
    Last Post: 09-19-2001, 09:08 AM