Thread: Help with basic program

  1. #1
    Registered User
    Join Date
    Sep 2005
    Posts
    1

    Help with basic program

    Ok so I need to convert from whole hours and minutest to decimal form and I am using this:
    time = hours + (minutes / 60) , however whenever I put this in I get this huge negative number, can anyone tell me why this is ????

  2. #2
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Can you show us a bit more code? It sounds like one of the variables being used to calculate time may be incorrect.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  3. #3
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    and what are the values of hours and minutes? Did you set them to something or just leave them contain whatever junk happens to be on the stack at the time?

    what data type is time? you should really use a different variable name because time is the name of a function defined in time.h.

  4. #4
    ~Team work is the best!~ wakish's Avatar
    Join Date
    Sep 2005
    Posts
    85
    can u give an example of the type of output u want?
    it's not so clear of what u want..and y are u dividing minute by 60?
    i think ur formula is not good, but post the outputs so that we can know what u really want.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 12:27 PM
  2. Basic encryption program???
    By Finchie_88 in forum C++ Programming
    Replies: 14
    Last Post: 09-10-2004, 09:01 AM
  3. IDEA: A basic drawing program
    By ygfperson in forum Contests Board
    Replies: 0
    Last Post: 08-12-2002, 11:15 PM
  4. Replies: 2
    Last Post: 05-10-2002, 04:16 PM
  5. Help me with this basic c program
    By [ToXiC]-[LeaK] in forum C Programming
    Replies: 1
    Last Post: 01-28-2002, 11:44 PM