14.10. Case Study: A Transaction-Processing Program
We now present a substantial transaction-processing program (Fig. 14.14) using a random-access file to achieve instant-access processing. The program maintains a bank’s account information. It updates existing accounts, adds new accounts, deletes accounts and stores a formatted listing of all current accounts in a text file. We assume that the program of Fig. 14.11 has been executed to create the file
credit.dat and that the program of Fig. 14.12 has been executed to insert the initial data. Line 25 opens the
credit.dat file by creating an
fstream object for both reading and writing in binary format.
1 // Fig. 14.14: Fig14_14.cpp 2 // This program reads a ...