Thread: defining codes

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    1

    defining codes

    I need to write a program for a vending machine where items cost between one cent and one dollar and no larger than a dollar.
    It has to give change back in quarters, nickels, dimes, and pennies. Do I need to tell it how to know how many of each to give back and if so how? Also, do I need to make restrictions for the item costs?

  2. #2
    Green Member Cshot's Avatar
    Join Date
    Jun 2002
    Posts
    892
    Yes and yes. Keep a counter of all your coins and increment everytime you need to give change for that particular type. Post some code if you have problems getting it.
    Try not.
    Do or do not.
    There is no try.

    - Master Yoda

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. codes
    By IfYouSaySo in forum A Brief History of Cprogramming.com
    Replies: 34
    Last Post: 11-18-2005, 03:09 PM
  2. im extreamly new help
    By rigo305 in forum C++ Programming
    Replies: 27
    Last Post: 04-23-2004, 11:22 PM
  3. Prime Number Generator... Help !?!!
    By Halo in forum C++ Programming
    Replies: 9
    Last Post: 10-20-2003, 07:26 PM
  4. include question
    By Wanted420 in forum C++ Programming
    Replies: 8
    Last Post: 10-17-2003, 03:49 AM