Thread: Help exercise!

  1. #1
    Registered User
    Join Date
    Sep 2009
    Posts
    5

    Unhappy Help exercise!

    I have a home work. I don't understand. Can you help me?

    Subject: Given an amount of money (less than 10,000VND), compute the number coin of 500VND, 1,000VND, 2,000VND, 5,000VND needed. Remember that the number of coin is minimized.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    What do you not understand about your home work?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Sep 2009
    Posts
    5
    Yes.I don't understand and I can't doing it. Can you help me!

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    I did not ask if you did not understand, since that was clear. I asked what it was that you did not understand.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    Registered User
    Join Date
    Sep 2009
    Posts
    5
    i don't understand algorithm

  6. #6
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Ah. If you want to "cheat", search the Web for "greedy algorithm". If you want to try to come up with an algorithm yourself (and you should), get some coins of different denominations, come up with some amount at random that can be made up of your coins, then try out systematic ways of solving the problem. When you have found one, implement it.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  7. #7
    Registered User
    Join Date
    Sep 2009
    Posts
    5
    Can you help me code it exercise?

  8. #8
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by sanhthai
    Can you help me code it exercise?
    Maybe, subject to the homework policy.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  9. #9
    Registered User
    Join Date
    Sep 2009
    Posts
    5
    Quote Originally Posted by laserlight View Post
    Maybe, subject to the homework policy.
    I don't post of homework

  10. #10
    Ex scientia vera
    Join Date
    Sep 2007
    Posts
    477
    Quote Originally Posted by sanhthai View Post
    I don't post of homework

    Nono, you wrote up an exercise for yourself that you didn't understand how to do.
    "What's up, Doc?"
    "'Up' is a relative concept. It has no intrinsic value."

  11. #11
    The larch
    Join Date
    May 2006
    Posts
    3,573
    It doesn't matter if the assignment was given to you by a teacher, or you found it from a book. The point of doing exercises is that you try to figure out things for yourself.

    Try it out with some sums and think how you came up with the answer.

    For example, if the sum is 9500 VND, then the coins you are looking for would be 1 x 5000, 2 x 2000 and 1 x 500.
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. programming exercise
    By mashour06 in forum C Programming
    Replies: 1
    Last Post: 06-01-2009, 06:22 AM
  2. Line of data input method
    By larry_2k4 in forum C Programming
    Replies: 2
    Last Post: 04-28-2009, 11:34 PM
  3. Can I get some idea for exercise?
    By Rokemet in forum C++ Programming
    Replies: 6
    Last Post: 11-22-2007, 09:10 AM
  4. Tutorial review
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 03-22-2004, 09:40 PM
  5. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM