I have this program that takes an amount of change and then tells how many of each type of coin you will receive back. I want to change this program so that a function will handle all of the calculations. What I want to know is if I'm even on the right track as far as doing this? I don't want to continue changing things if I'm doing it wrong...

Code:// *********************************************************** // Program Make Change: Given any amount of change expressed // in cents, this program computes the number of half-dollars, // quarters, dimes, nickels, and pennies to be returned, // returning as many half-dollars as possible, then quarters, // dimes, nickels, and pennies in that order. //************************************************************ //header file #include <iostream> using namespace std; //named constants void convertChange(int tempchange, int& nQuarter, int& nDime, int& nNickel, int& nonedollar, int& nfivedollar, int& ntendollar, int& ntwentydollar); const int Halfdollar = 50; const int Quarter = 25; const int Dime = 10; const int Nickel = 5; const int onedollar = 100; const int fivedollar = 500; const int tendollar = 1000; const int twentydollar = 2000; int main() { //declare variable int change; double changeone; //Statements: Step 1 - Step 12 cout << "Enter change in decimal value: "; //Ask user for change in decimal value cin >> changeone; //Input change cout << endl; cout << "The change you entered is " << changeone << endl; //Output entered change change = changeone * 100; cout << "The number of 20 dollars to be returned is "; //<< change / twentydollar << endl; //change = change % twentydollar; cout << "The number of 10 dollars to be returned is "; //<< change / tendollar << endl; //change = change % tendollar; cout << "The number of 5 dollars to be returned is "; //<< change / fivedollar << endl; //change = change % fivedollar; cout << "The number of 1 dollars to be returned is "; //<< change / onedollar << endl; //change = change % onedollar; //cout << "The number of half-dollars to be returned " //<< "is " << change / Halfdollar //<< endl; //Perform integer division to find number of half-dollars to be returned. //change = change % Halfdollar; //Remove change from larger value. cout << "The number of quarters to be returned is "; //<< change / Quarter << endl; //Perform integer division to find number of quarters to be returned. //change = change % Quarter; //Remove change from larger value. cout << "The number of dimes to be returned is "; //<< change / Dime << endl; //Perform integer division to find number of dimes to be returned. //change = change % Dime; //Remove change from larger value. cout << "The number of nickels to be returned is "; //<< change / Nickel << endl; //Perform integer division to find number of nickels to be returned. //change = change % Nickel; //Remove change from larger value. cout << "The number of pennies to be returned is "; //<< change << endl; //Use remaining change to find number of pennies. return 0; } void convertchange(int change, int nQuarter, int nDime, int nNickel, int nonedollar, int nfivedollar, int ntendollar, int ntwentydollar) { const int Quarter = 25; const int Dime = 10; const int Nickel = 5; const int onedollar = 100; const int fivedollar = 500; const int tendollar = 1000; const int twentydollar = 2000; nDime = change / Dime; change change % Dime; nQuarter = change / Quarter; change = change % Quarter; nNickel = change / Nickel; change = change % Nickel; }