// Total USD Currency To USD Change
// February 19th 2010
// Created By Nic Raboy

#include <iostream>

using namespace std;

/*
  * We are throwing a & in front of our coin variables because we would like to
  * edit them inside the function and not have to return them.  However, we shouldn't
  * do that for the total currency amount because it will be converted and we may want
  * to keep track of how much money we started with
 */
void change(int &quarters, int &dimes, int &nickels, int &pennies, float total)
{
	int t = total * 100;	// Convert to integer because modulus doesn't work on floats
	quarters = t / 25;	// Figure out how many quarters we have in our total
	t = t % 25;	// How much remaining money we have after taking out quarters
	dimes = t / 10;	// Figure out how many dimes we have in our total
	t = t % 10;	// How much remaining money we have after taking out dimes
	nickels = t / 5;	// Figure out how many nickels we have in our total
	t = t % 5;	// How much remaining money we have after taking out nickels
	pennies = t / 1;	// Figure out how many pennies we have left in our total
	t = t % 1;	// Bring total to zero
}

int main()
{
	// Declare our variables
	int q, d, n, p;
	float t;
	// Loop until we input -1 as our total currency.  This will stop the program
	while(t != -1)
	{
		// Make sure we reset all of our variables before each loop
		q = 0; d = 0; n = 0; p = 0; t = 0;
		cout << "How much money do you have?> ";
		cin >> t;
		// Stop the program if the input is -1
		if(t == -1) { break; }
		// Call our calculate change function
		change(q, d, n, p, t);
		// Print out everything we have
		cout << "Quarters: " << q << endl;
		cout << "Dimes: " << d << endl;
		cout << "Nickels: " << n << endl;
		cout << "Pennies: " << p << endl;
	}
	return 0;
}