The reading club needs a small catalog that can find books, track loans, and print a shelf report. You will build it in one C++ file over five stages. Each next starter includes the completed earlier definitions and data, so you can focus on the next small capability. Everything lives in memory: each Run reconstructs the same starting catalog.
The vector owns ordinary Book values, and the helpers will borrow records only when needed. There is no need for a separate allocation per book or an inheritance tree: all records have the same fields and loan rules. This project combines the earlier tools according to the problem, rather than using every feature you have learned.
Book groups four facts. id identifies the book even if a title changes. title is display text. pages is a positive page count. onLoan is true when the book is away and false when it is available. The identifiers below are unique; later lookup and lending code rely on that promise. These are data rules, not checks enforced by Book: its public fields and the vector would allow duplicate ids or nonpositive page counts. For this fixed project, you establish the rules by entering the supplied records correctly.
| id | title | pages | onLoan |
|---|---|---|---|
| 101 | River Paths | 180 | false |
| 102 | City Gardens | 240 | true |
| 103 | Night Sky | 120 | false |
The starter contains three placeholder records, one for each table row. They let the reporting loop run, but their zero identifiers and page counts are not valid catalog data. Replace all four fields in each record, keeping the table's order. Nested braces initialize the vector, then each Book inside it. Field order follows the struct declaration; a row such as {201, "Small Atlas", 96, false} supplies all four fields together.
The supplied loop uses std::size_t, the unsigned size type returned by vector::size(), to visit valid indices. const Book& views a record without copying or changing it. You only edit the three records, not this reporting loop.
Do not add file storage or interactive input. Fixed data makes each stage reproducible and lets you concentrate on behavior. Later stages will use temporary copies for loan experiments, preserving this canonical catalog for the final report.
Edit main.cpp; the supplied Console probes already call your code.
Record 1: 101 | River Paths | 180 | false.Record 2: 102 | City Gardens | 240 | true.Record 3: 103 | Night Sky | 120 | false.Use Run to inspect the Console, then Submit to check your work.