I am trying to learn C++ by myself using a book and want to work through everything it says. I am on a program that you have to write kinda like a cash register program that tells you how many 5's, 1's, quarters, dimes, nickles, and pennies you should get back. It wants you to create a seperate function to do the calculations. I am really lost. I have bits and pieces, but I don't know what to do. I've been going on this for about 6 hours now trying to figure stuff out and ended up just starting over a bunch of times cause it was just completely wrong. The code I have is below, but I don't know what to do from here. Any help would be GREATLY appreciated. Thank you so much.
#include <iostream>
#include <conio.h>
#include <iomanip>
using namespace std;
float calcchange(float, float, float, float, float, float, float); //function prototype
int main ()
{
float ftotal = 0,
fcents = 0,
fchange = 0,
ffives = 0,
fones= 0,
fquarters = 0,
fdimes = 0,
fnickles = 0,
fpennies = 0;
cout << " ~~~~~~~~Payroll Calculator ~~~~~~~~~~" << endl;
cout << "Enter the total price: ";
cin >> ftotal;
//fpay = fhours * frate;
fchange = calcPay(ftotal,ffives,fones,iquarters,); // call function and send to arguments
cout << "The total pay is $" << setprecision(2) << fixed
<< fpay << endl;
cout << "any key..." << endl;
_getch();
return 0;
}
float calcPay(float h, float r)
{
// compute the change
while (cents >= 25) {
quarters++;
cents -= 25;
}
while (cents >= 10) {
dimes++;
cents -= 10;
}
while (cents >= 5) {
nickels++;
cents -= 5;
}
while (cents >= 1) {
pennies++;
cents -= 1;
}
}