
Everyday Problems 49
78 int main()
79 {
80 // Checkbook to test
81 check_vector checkbook;
82
83 // File to read the check data from
84 std::ifstream in_file("checks.txt");
85
86 if (in_file.bad()) {
87 std::cerr << "Error opening input file\n";
88 exit (8);
89 }
90 while (1) {
91 check_info next_info; // Current check
92
93 next_info.read(in_file);
94 if (in_file.fail())
95 break;
96
97 checkbook.push_back(next_info);
98 }
99 double total = 0.00; // Total in the bank
100 for (check_vector::iterator
101 cur_check = checkbook.begin();
102 cur_check != checkbook.end();
103 cur_check++)
104 {
105 cur_check->print(std::cout);
106 total += cur_check->amount;
107 }
108 std::co ...