Need some hints, not sure how to do this

This is a discussion on Need some hints, not sure how to do this within the C++ Programming forums, part of the General Programming Boards category; Given an amount less than $1.00, compute the number of quarters, dimes, nickels, and pennies needed. so i'd need a ...

  1. #1
    Registered User ferfy's Avatar
    Join Date
    Nov 2011
    Location
    Michigan
    Posts
    22

    Need some hints, not sure how to do this

    Given an amount less than $1.00, compute the number of quarters, dimes, nickels, and pennies needed.

    so i'd need a variable for quarters, dimes, nickels, & pennies. and another variable..... not sure exactly how to do this though

  2. #2
    Registered User
    Join Date
    Mar 2012
    Posts
    110
    I take it you haven't studied math, then it can be somewhat tricky. But for starters, you need to google diophantine equations.

  3. #3
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    1,623
    In this thread, what you ask is answered.
    Devoted my life to programming...

  4. #4
    Registered User
    Join Date
    Mar 2012
    Posts
    3
    Why couldn't you just use loops and start with subtracting quarters, then go smaller and smaller(dimes, nickels, pennies).

    for example, with 67 cents, it would start with a loop that subtracted 25 twice, each time adding 1 to quarters, then once the amount inquestion is less than 25, do a similar action for the other coins(17- 10 would leave 1 dime, 7-5 would leave one nickel, etc)?

    i can draw up an example of the actual code if necessary.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need a few hints.
    By millcityrider in forum C Programming
    Replies: 8
    Last Post: 10-07-2011, 11:06 AM
  2. any hints to solving this?
    By sjcc in forum C Programming
    Replies: 5
    Last Post: 03-12-2009, 12:11 PM
  3. Can you give me some hints?
    By mag_chan in forum C Programming
    Replies: 6
    Last Post: 12-05-2005, 03:04 PM
  4. Can you give me some hints?
    By mag_chan in forum C++ Programming
    Replies: 1
    Last Post: 12-04-2005, 01:12 AM
  5. :) Help.. Please... I need some hints
    By NANO in forum C++ Programming
    Replies: 7
    Last Post: 04-16-2002, 03:06 AM

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