79181544

Date: 2024-11-12 14:39:26
Score: 0.5
Natty:
Report link

Create a Library Class: o Attributes:  A dynamically allocated array of Book pointers to store books.  An integer capacity to track the maximum number of books the library can hold.  An integer count to track the current number of books in the library. o Constructors:  A parameterized constructor to set the library’s capacity and initialize the array to hold up to that many books. o Destructor:  A destructor to release any dynamically allocated memory and delete each book in the library. o Methods:  bool addBook(const Book& book) – Adds a new book to the library. If the library is full, print an error message.  bool removeBook(const std::string& title) – Searches for a book by title and removes it if found. If not found, print an error message.  void displayAllBooks() – Displays details of all books in the library.  Book* findBook(const std::string& title) – Returns a pointer to the book with the specified title (or nullptr if not found).  void clearLibrary() – Deletes all books from the library without deallocating the library’s array itself.

Reasons:
  • Long answer (-1):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Shahed Banihani