The final stage turns the retained catalog and summaries into a readable report. No earlier function is left unfinished. You will add three focused formatting helpers, while the supplied printing loop calls them in catalog order.
loanText translates a boolean into a reader-facing word. bookLine builds a row from a single read-only Book. summaryLine describes the whole catalog by calling the summary helpers you completed previously. Keeping these responsibilities separate means a wording change does not require rewriting lookup or lending logic.
std::ostringstream, already included from <sstream>, collects streamed values in memory rather than sending them to the Console. Write into it with <<, then call .str() to obtain the resulting std::string. For example, a small label could be built with text << "Shelf " << number;. The insertion writes into the stream; .str() then returns reusable text. The local stream can be destroyed when the helper returns because the returned string holds its own value. This is different from returning a pointer or reference to a local object.
The row format is id | title | pages pages | status. The repeated word “pages” is a literal unit label after the number. The status is either available or on loan. The summary is Summary: 3 books | 2 available | 540 pages for this fixture. Use vector size and the completed helper results rather than copying those numbers into the function.
Complete loanText before bookLine, because each book row calls it to obtain the status wording. The separate status line checks loanText directly. summaryLine uses the already-completed counting helpers, so it does not depend on the new row formatter. The final report prints a heading, all rows, and the summary. Earlier diagnostic lines remain above it so the program retains its complete development history. Every Run begins from the same in-memory catalog; the lending trials use copies and do not silently change the final report.
Edit main.cpp; the supplied Console probes already call your code.
loanText return "on loan" for true and "available" for false. Expect Statuses: available on loan.bookLine to build each row from the fields and loanText. Expect 101 | River Paths | 180 pages | available, and corresponding rows for books 102 and 103. Do not add a newline inside the returned string.summaryLine with books.size(), availableCount, and pageTotal. Expect the standalone line Summary: 3 books | 2 available | 540 pages.Use Run to inspect the Console, then Submit to check your work.