// Mr. Minich
// Wyo C++
// Ch. 9 Demo Program #9
// October 17, 2001
// Purpose - to illustrate passing by reference and the use of a bool return value


#include <iostream.h>

bool changeToOnes(int &, int &);

int main()
{
	int ones = 0;
	int tens = 0;

	cout << "How many one dollar bills? ";
	cin >> ones;
	cout << "How many ten dollar bills? ";
	cin >> tens;

	cout << "You have " << tens << " tens." << endl;
	cout << "You have " << ones << " ones." << endl << endl;

	if (changeToOnes(ones, tens))
	{
		cout << "After converting everything to ones... " << endl;
		cout << "You have " << tens << " tens." << endl;
		cout << "You have " << ones << " ones." << endl;
	}
	else
	{
		cout << "You have no money to start with, why did you bother trying"
			 << " to use this program?" << endl;
	}
	
	return 0;
}// end of main

bool changeToOnes(int & myOnes, int & myTens)
{
	myOnes = myTens * 10 + myOnes;
	myTens = 0;

	if (myOnes > 0)
	{
		return true;
	}
	else
	{
		return false;
	}

}// end of changeToOnes