View Single Post
  #2 (permalink)  
Old July 1st, 2003, 01:21 PM
natmaster natmaster is offline
Authorized User
 
Join Date: Jun 2003
Posts: 83
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to natmaster Send a message via AIM to natmaster Send a message via MSN to natmaster
Default

here is a simple way to do that, but i will only write a little code since it is homework:
double amount;
int dollars=0,quarters=0,dimes=0,pennies=0;
//if there is at least 1 dollar
if(amount/1 >= 1) {
//turning the equation into an int chops off any excess
  dollars=(int)(amount/1);
//rest of the money to be processed by lower functions
  amount=amount%1;
}

now continue that if statement for each of the variables of money descending in value. (next do quarters and use amount/.25 as the equation)

----------------------------
http://aeonofdarkness.com
Reply With Quote