I've been trying to get this, but no matter what method I try, nothing works and the book shows only the most simplistic examples. I have other functions currently that run, but with global values. I want to fix it all, but to do that, I need to get the following function to work:
function prototype:
int ToTaling(int &,int &,int &,int &,int &,int &,int &,int &,int &);
(OR)
//int &TotalRate, int &TotalRegHou rs, int &TotalOvtHou rs, int &TotalGrossP ay,
// int &TotalFedTax , int &TotalStateT ax, int &TotalSSITax , int &TotalDeferr ed,
// int &TotalNet);
(I tried it with the actual names, I tried it with * instead of ampersand, what am I missing here? I've also tried void at the beginning. Nothing seems to work.)
(inside main)
int TotalRate, TotalRegHours, TotalOvtHours, TotalGrossPay, TotalFedTax,
TotalStateTax,T otalSSITax, TotalDeferred,T otalNet;
ToTaling(&Total Rate,&TotalRegH ours,&TotalOvtH ours,&TotalGros sPay,
&TotalFedTax,&T otalStateTax,&T otalSSITax,&Tot alDeferred,
&TotalNet);
And then the function outside the main:
{
int J = 0;
while (J<=H){
TotalRate=Total Rate+Payrate[J]; // equals Total += Hours[J+1];
TotalRegHours=T otalRegHours+Re gHours[J]; // equals Total += Hours[J+1];
TotalOvtHours=T otalOvtHours+Ov tHours[J];
TotalGrossPay=T otalGrossPay+Ca lcGross[J];
TotalFedTax=Tot alFedTax+calcFe d[J];
TotalStateTax=T otalStateTax+ca lcState[J];
TotalSSITax=Tot alSSITax+calcSS i[J];
TotalDeferred=T otalDeferred+De ferred[J];
TotalNet=TotalN et+NetPay[J]; // equals Total += Hours[J+1];
J=J+1;
}
return (TotalRate, TotalRegHours, TotalOvtHours, TotalGrossPay, TotalFedTax,Tot alStateTax, TotalSSITax, TotalDeferred, TotalNet);
}
The current error I'm getting is : cannot convert parameter 1 from 'int *' to 'int &' ....
The following line:
&TotalNet); (in the main, though probably the entire thing!)
Thanks for any and all help!
function prototype:
int ToTaling(int &,int &,int &,int &,int &,int &,int &,int &,int &);
(OR)
//int &TotalRate, int &TotalRegHou rs, int &TotalOvtHou rs, int &TotalGrossP ay,
// int &TotalFedTax , int &TotalStateT ax, int &TotalSSITax , int &TotalDeferr ed,
// int &TotalNet);
(I tried it with the actual names, I tried it with * instead of ampersand, what am I missing here? I've also tried void at the beginning. Nothing seems to work.)
(inside main)
int TotalRate, TotalRegHours, TotalOvtHours, TotalGrossPay, TotalFedTax,
TotalStateTax,T otalSSITax, TotalDeferred,T otalNet;
ToTaling(&Total Rate,&TotalRegH ours,&TotalOvtH ours,&TotalGros sPay,
&TotalFedTax,&T otalStateTax,&T otalSSITax,&Tot alDeferred,
&TotalNet);
And then the function outside the main:
{
int J = 0;
while (J<=H){
TotalRate=Total Rate+Payrate[J]; // equals Total += Hours[J+1];
TotalRegHours=T otalRegHours+Re gHours[J]; // equals Total += Hours[J+1];
TotalOvtHours=T otalOvtHours+Ov tHours[J];
TotalGrossPay=T otalGrossPay+Ca lcGross[J];
TotalFedTax=Tot alFedTax+calcFe d[J];
TotalStateTax=T otalStateTax+ca lcState[J];
TotalSSITax=Tot alSSITax+calcSS i[J];
TotalDeferred=T otalDeferred+De ferred[J];
TotalNet=TotalN et+NetPay[J]; // equals Total += Hours[J+1];
J=J+1;
}
return (TotalRate, TotalRegHours, TotalOvtHours, TotalGrossPay, TotalFedTax,Tot alStateTax, TotalSSITax, TotalDeferred, TotalNet);
}
The current error I'm getting is : cannot convert parameter 1 from 'int *' to 'int &' ....
The following line:
&TotalNet); (in the main, though probably the entire thing!)
Thanks for any and all help!
Comment