A catalog report needs totals as well as individual records. The existing lookup and loan operations remain complete; this stage adds two read-only summaries. The canonical catalog still starts with River Paths and Night Sky available and City Gardens on loan. The previous trial copies do not alter it.
availableCount counts records whose onLoan field is false. pageTotal adds the pages from every record, whether borrowed or available. These are different questions: availability filters records, while the page total describes the whole collection.
Use the count already initialized in availableCount: inspect each record and increment it only when the book is available. In pageTotal, add every record's pages to the supplied total, including books on loan. Do not add a second accumulator or move the return into the loop. Both functions take const std::vector<Book>&, making a read-only view of the vector. Use const Book& for each record so the loop also expresses that no mutation is intended.
Each starter helper already declares and returns its accumulator. Fill only the indicated loop area. A zero accumulator is the right result for an empty catalog, so it also makes the unfinished helpers safe. The supplied probes call both helpers with the real catalog and with an empty vector.
The project fixture is small enough that page totals fit comfortably in int. A production catalog would need a documented size limit or checked arithmetic like the earlier reliability lesson. Here the goal is to connect an explicit aggregation rule to a reusable helper, not to add unrelated storage or formatting concerns.
The next stage will use these completed summaries in a final report. Keeping calculations separate from output allows the same answers to be reused without duplicating loops inside the formatter.
Edit main.cpp; the supplied Console probes already call your code.
availableCount, incrementing only for books not on loan. Expect Available: 2 and Empty available: 0.pageTotal, adding every book’s page count. Expect Pages: 540 and Empty pages: 0.Use Run to inspect the Console, then Submit to check your work.