Question: c + + / / Description: Your manager requires a program to manage a list of books. The program should allow adding and removing books
c Description:
Your manager requires a program to manage a list of books. The program should allow adding and removing books from the list, as well as displaying the list.
This program begins by loading books from a text file into an array and then presents a menu to process menu options.
Specifications:
Utilize an array of strings to represent the list of books.
Implement a menu system enabling users to add, remove, and display book array.
Develop six functions, excluding the main function, each operating on the book array. Function prototypes are provided, and you must define each function body.
Declare the book array with a size of and consider using a global variable to track the total number of books in the array.
Function Descriptions:
loadBooks: Read titles from 'input.txt and store them in the array until the end of file. It doesn't return any value. Prototype: "void loadBooksstring int
addBook: Add a book title to the array if array space is available. Accept the list of books, the array size, and the title. Increase the global variable. Returns true if successful, false if the array is full. Prototype: bool addBookstringl int, string;
showList: Accepts the list of books and displays the titles currently in the array. Prototype: void showListstring;
removeBook: Invoked when the user selects the "Remove Book" option, this function takes in the list of books, its array size, and the title to be removed. If the given title exists in the list, it is deleted, and the function returns true; otherwise, it returns false. Prototype: bool removeBookstringl int, string;
The removeBook function calls the following two functions:
getBookPosition: Accepts the list of books, its array size, and a string containing the title of the book to be removed. It searches the list for the title and, if found, returns the position of the book in the list; otherwise, it returns If the title appears more than once in the list, this function can return any of its positions. Prototype: int getBookPositionstring int, string; removeBookAtPosition: Accepts the list of books, its size, and the position of the book to be removed in the list. It removes a book from a list by shifting all subsequent elements down one position and decreases the global variable. Optionally, it sets the last element to an empty string. Prototype: void removeBookAtPositionstringl int, int;
Create an input text file with the following:
Pride and Prejudice
To Kill a Mockingbird
The Unbearable Lightness of Being
The Great Gatsby
In Cold Blood
Jane Eyre
Crime and Punishment
To the Lighthouse
Frankenstein
The GoBetween
The Grapes of Wrath
Beloved
Harry Porter
Dracula
The Load of the Rings
Great Expectations
The Age of Innocence
Vanity Fair
Alice's Adventure in Wonderland
Les Misrables
Ulysses
Sample output: user inputs are underlined.
What would you like to do today?
Add Book
Remove Book
Show list of books
Exit
What book would you like to add?
Harry Porter
Book was successfully added.
What would you like to do today?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
