... 29
30      // read all records from file
31      while (inCredit) {
32         // display record
33         if (client.getAccountNumber() != 0) {
34            outputLine(cout, client);
35         }
36
37         // read next from file
38         inCredit.read(reinterpret_cast<char*>(&client), sizeof(ClientData));
39      }
40   }
41
42   // display single record
43   void outputLine(ostream& output, const ClientData& record) {
44      output << left << setw(10) << record.getAccountNumber()
45         << setw(16) << record.getLastName()
46         << setw(11) << record.getFirstName()
47         << setw(10) << setprecision(2) << right << fixed
48         << showpoint << record.getBalance() << endl;
49   }

Account   Last Name       First Name     Balance
29        Brown           Nancy           -24.54
33        Dunn            Stacey          314.33
37        Barker          Doug              0.00
88        Smith           Dave            258.34
96        Stone           Sam              34.98

Figure ...

Get C++ How to Program, 10/e now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.