### Add and minus from the text file arent give the right value.

I'm going to try explain the best way i can.

I'm creating a bank system.

So I know to make a deposit to the balance, which add ups what is the balance to i have add.

When i run the deposit function, its work well in some ways. If balance(text file) has the value 10, add i addSum 20, the balance will become 30, same as the text file will become 30. so its work well to add positive number.

 ``1234567891011121314151617181920212223242526`` ``````double deposit(double balance) { double addSum = 0; system("CLS"); cout<< "Welcome to deposit."<> addSum; balance = addSum + balance; myfile << balance; cout << balance << '\n'; system("CLS"); return balance; }``````

When I withdraw from 30 which is the balance, then i takeSum, for example i take away 30. The balance will become 30 - 30 = 0
When i make another withdraw from example -150, it will be -150.

Which shows correct.

But when i make a deposit from -150 and i addSum 130, the balance shows -500, and it should had been -20.

 ``12345678910111213141516171819202122232425`` ``````double withdraw(double balance) { double takeSum = 0; system("CLS"); cout<< "Welcome to withdraw."<> takeSum; balance = balance - takeSum; myfile << balance; cout << balance << '\n'; system("CLS"); return balance; }``````

My case statement to understand better.
 ``12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364`` ``````int main() { double balance = 0; balance = currentBalance(balance); menu(balance); return 0; } // menu function int menu(double balance) { int menuOption = 0; cout<<" \n---------------------------------------------------"<>menuOption; switch(menuOption) { case 1: unscreen(); menu(balance); break; case 2: readBalance(balance); menu(balance); break; case 3: balance = withdraw(balance); readBalance(balance); menu(balance); break; case 4: balance = deposit(balance); readBalance(balance); menu(balance); break; case 9: exit(0); default: cout<<"You did not choose from the menu options, reloading the menu!"<

What is causing this problem, also when function deposit and withdraw close, it goes to readBalance function, should go to menu.

 ``1234567891011121314151617181920212223242526272829303132333435363738394041424344`` ``````double readBalance(double balance) { int option; system("CLS"); cout<<"Welcome to balance."<> balance; // Read the values and // store them in these variables fin.close(); // Close the file } cout << balance << '\n'; cout<<"\n"<> option; if (option == 9) { exit(0); } else if (option == 0 ) { return balance; } else { exit(0); } }``````