Hi,
The function declaration would be
void Money(double nDollarValue, int& nQuarters, int& Dimes, int& Nickels, int& Pennies);
The function definition would be written as
// Simple straightforward solution
void Money(double nDollarValue, int& nQuarters, int& nDimes, int& nNickels, int& nPennies)
{
int work = (int) ((nDollarValue + .005) * 100.0);
nQuarters = (int) (work / QUARTER);
work = work % QUARTER;
nDimes = (int) (work / DIME);
work = work % DIME;
nNickels = (int) (work / NICKEL);
work = work % NICKEL;
nPennies = (int) (work / PENNY);
}
and the main body of the program would look like:
enum {QUARTER = 25, DIME = 10, NICKEL = 5, PENNY = 1};
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
float nDollarValue = 3.17f;
int nQuarters, nDimes, nNickels, nPennies;
Money(nDollarValue, nQuarters, nDimes, nNickels, nPennies);
return 0;
}
Hope this helps