Another way to think of it is to change all your amounts into pennies by multiplying them X 100.
Now 10.57 becomes 1057, and 5.95 becomes 595. Everything becomes an int since there are no tenths or hundred's of a penny.
To change it back to normal change, use a while loop:
Code:
dollars = quarters = dimes = nickels = pennies = 0;
while(amount > 0) {
if(amount > 100)
amount = amount - 100;
dollars++;
}
else if(amount > 24) {
amount = amount - 25;
quarters++;
}
//continue with this logic with dimes, nickels, and pennies, until you have diminished
//amount to zero.
} //end of while loop