exercise problems

This is a discussion on exercise problems within the C Programming forums, part of the General Programming Boards category; In my C How To Program book, I've worked through a number of the exercises but there are 2 that ...

  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    7

    Question exercise problems

    In my C How To Program book, I've worked through a number of the exercises but there are 2 that I just can't seem to figure out. One exercise has a portion where I'm supposed to take a digit like 1234 and write it to the screen with 2 spaces in between like 1 2 3 4 . The other one I can't figure out is how to pass in a time and pass back the number of seconds that have passed since the last time the clock hit 12 (noon or midnight, doesn't matter). Can anyone give me any ideas on these? I'm not asking anyone to write my code, just some ideas. Thanks.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,494
    > One exercise has a portion where I'm supposed to take a digit like 1234
    The operations
    x / 10
    x % 10
    are useful

    > pass back the number of seconds that have passed since the last time the clock hit 12
    hrs * SEC_PER_HOUR + min * SEC_PER_MIN + sec

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Line of data input method
    By larry_2k4 in forum C Programming
    Replies: 2
    Last Post: 04-28-2009, 11:34 PM
  2. No clue how to make a code to solve problems!
    By ctnzn in forum C Programming
    Replies: 8
    Last Post: 10-16-2008, 02:59 AM
  3. Tutorial review
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 03-22-2004, 08:40 PM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 09:33 AM
  5. DJGPP problems
    By stormswift in forum C Programming
    Replies: 2
    Last Post: 02-26-2002, 03:35 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21