#include #include using namespace std; class Library { private: string owner; vector books; public: Library(string name) : owner(name) {} void addBook(string book) { books.push_back(book); cout << "Book '" << book << "' added successfully!\n"; } void removeBook(string book) { for (size_t i = 0; i < books.size(); i++) { if (books[i] == book) { books.erase(books.begin() + i); cout << "Book '" << book << "' removed successfully!\n"; return; } } cout << "Book not found in the library.\n"; } void listBooks() const { if (books.empty()) { cout << "Your library is empty.\n"; } else { cout << "Books in your library:\n"; for (const string &book : books) { cout << "- " << book << "\n"; } } } }; int main() { string name; cout << "Welcome to Your Personal Library Management System!\n"; cout << "What is your name? "; getline(cin, name); Library myLibrary(name); int choice; do { cout << "\nMENU:\n"; cout << "1. List all books\n"; cout << "2. Add a new book\n"; cout << "3. Remove a book\n"; cout << "4. Exit\n"; cout << "Enter your choice: "; cin >> choice; cin.ignore(); if (choice == 1) { myLibrary.listBooks(); } else if (choice == 2) { string book; cout << "Enter book name: "; getline(cin, book); myLibrary.addBook(book); } else if (choice == 3) { string book; cout << "Enter book name to remove: "; getline(cin, book); myLibrary.removeBook(book); } else if (choice == 4) { cout << "Thank you for using the Library Management System!\n"; } else { cout << "Invalid choice. Please try again.\n"; } } while (choice != 4); return EXIT_SUCCESS; }