Hello again,
I am having a hard time keeping the updated balances, can someone please help me?
this is are my functions in a class called "functions"
Code:
void DepositAmt(double *dep_amount,double *cur_bal)
{
*dep_amount = *dep_amount + *cur_bal;
}
void WithdrawalAmt(double *wdl_amount,double *cur_bal)
{
*wdl_amount = *cur_bal - *wdl_amount;
}
void PrintStatement(Account acc)
{
acc.get_data();
}
void getFinalBalance(double *cur_bal, double *dep_amount, double *wdl_amount)
{
*cur_bal = *cur_bal + *dep_amount - (wdl_amount;
}
and here is my main snippet
Code:
if (choice == 1)
{
numtrans = numtrans + 1;
cout<<"*************************************************"<<endl;
cout<<"Please enter the amount you would like to deposit"<<endl;
cin>>dep_amount;
func.DepositAmt(&dep_amount, &cur_bal);
}
cout<<"you have deposited : "<<dep_amount<<endl;
cout<<"you have withdrew : "<<wdl_amount<<endl;
cout<<"your current balance is: "<<cur_bal<<endl;
my problem is that in the end, when I want to display the total deposited and the current balance, it only displays the last amount that I deposited and current balance at zero.
I have tried various things and your help would be appreciated.
thank you in advance.