First of all you mix functions and variables.
void averageDailyBalancefn(double& balance,double netBalance,double d1,double d2,double payment){
balance = (netBalance * d1 - payment * d2)/d1;
}
I have deliberately changed the name of the parameter. If you want to get the result use & after the type and call this function like that:
double averageDailyBalance;
averageDailyBalancefn(avarageDailyBalance, 500, 0.5, 0.6, 1000);
std::cout << averageDailyBalance << std::cout;
You may have defined the function differently:
double averageDailyBalancefn(double netBalance,double d1,double d2,double payment){
return (netBalance * d1 - payment * d2)/d1;
}
Then you call it like this:
double averageDailyBalance;
averageDailyBalance = averageDailyBalancefn(avarageDailyBalance, 500, 0.5, 0.6, 1000);
Don't mix up variable names and function names.
Define a variable, assign a value to it if needed, call a function with passing parameters from variables, get the results.
Print the results out. See that you get correct results.
Don't try to write big chunks of code and then try to debug them.