Code:
#include <iostream.h>
#include <fstream.h>
main()
{
int OpenBalance, Deposit, Withdrawal, NewBalance, NewBalanceTwo;
ifstream fin;
fin.open("bank.txt");
fin<<OpenBalance;
fin<<Deposit;
fin<<Withdrawal;
fin<<NewBalance;
fin<<NewBalanceTwo;
fin.close();
cout<<"Opening Balance: $"<<OpenBalance;
cout<<"\nDeposit: $"<<Deposit<<" New Balance: $"<<NewBalance;
cout<<"Withdrawal: $"<<Withdrawal<<" New Balance: $"<<NewBalanceTwo;
cin<<NewBalance;
return 0;
}
and when you save to the file use this:
Code:
ofstream fout;
fout.open("bank.txt");
fout>>OpenBalance;
fout>>Deposit;
fout>>Withdrawal;
fout>>NewBalance;
fout>>NewBalanceTwo;
fout.close();
make sure your numbers are stored in the variables i used, or jsut switch my variable names to yours.