Blocked...Blocked

This is a discussion on Blocked...Blocked within the C Programming forums, part of the General Programming Boards category; I need some help on an assignment I have been staring at blankly for 2 hours. I do'nt want the ...

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    3

    Blocked...Blocked

    I need some help on an assignment I have been staring at blankly for 2 hours. I do'nt want the code just some pseudo to kick start as I feel relly dumb.
    The program requires a wage to be entered by user and then a function call to tell the user exatly what notes and coins to place in the wage. The principle is the same as breaking a number into 100's, 50's etc but I cannot think how to start.
    Any help would be warmly welcomed.
    ta

  2. #2
    zen
    zen is offline
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    You can use integer division to divide the amout by the largest denomination to get that amount. Then divide the remainder by the second largest and so on..........

  3. #3
    Registered User
    Join Date
    Sep 2001
    Posts
    3

    Exclamation

    Zen

    Where would the remainder be held? if I used:

    total_of_20 = (float)pounds/20;

    I thought this would just give me a decimal answer instead of a whole number. Would I not use modulus for a remainder. I cannot think thru this and I have chewed thru 4 pens up to now.

  4. #4
    zen
    zen is offline
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    You want something like:

    total_of_20 = pounds/20;
    pounds = pounds%20;
    total_of_10 = pounds/10;
    pounds = pounds%10;

  5. #5
    Registered User
    Join Date
    Sep 2001
    Posts
    3
    cheers zen
    I was doing something similar to that but abandoned it all in a huff. I shall reread and try that way.
    thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Where do a task get "wakeuped", blocked, preempted?
    By micke_b in forum Linux Programming
    Replies: 4
    Last Post: 12-28-2007, 03:49 PM
  2. blocked sites
    By munna_dude in forum Networking/Device Communication
    Replies: 3
    Last Post: 05-23-2007, 04:53 AM
  3. detect being blocked by a firewall
    By efimpp in forum Networking/Device Communication
    Replies: 3
    Last Post: 04-11-2005, 03:02 PM
  4. my account is blocked - MystWind--why?
    By waykeeper in forum C++ Programming
    Replies: 1
    Last Post: 03-08-2005, 02:05 PM
  5. Terminating blocked thread (MS VC++)
    By IndigoTangoOne in forum C++ Programming
    Replies: 1
    Last Post: 09-03-2004, 06:56 AM

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