Question
Write a C program that implements a Linked List of strings that will be read from a file. It should display a menu that resembles
Write a C program that implements a Linked List of strings that will be read from a file. It should display a menu that resembles the following:
1. Display Library
2. Check Out Item
3. Query for Author
4. Exit
The first step is to read in the entire library from the provided file (called library.txt). Use this file to create and populate your Linked List. Then, depending on the users selection, your program should respond appropriately. For example, if the user wishes to view the contents of the library, your program should iterate over the list and display each item. If they choose to check out a book from the library, your program should check if the book exists, and if so, remove it from the list and return it to the user. Finally, if the user chooses to query for an author, your program should return all the books found by that author. The program should build the library in sorted order based on author name. So each time a book is added, you should iterate over the list to put your book in the correct place.
library.txt file:
Night Shift,Stephen King,336 Salem's Lot,Stephen King,439 Cujo,Stephen King,321 Harry Potter and The Chamber of Secrets,JK Rowling,341 20th Century Ghosts,Joe Hill,304 Jurassic Park,Michael Crichton,355 Congo,Michael Crichton,300 Ghost Story,Peter Straub,456 A Game of Thrones,George R.R. Martin,674 Farenheit 451,Ray Bradbury,296 1984,George Orwell,303 American Gods,Neil Gaiman,709 The Call of Cthulu,H.P. Lovecraft,136 A Tale of Two Cities,Charles Dickens,341 The Davinci Code,Dan Brown,454 Gone Girl,Gillian Flynn,302 The Chamber,John Grisham,299 The Fellowship of the Ring,JRR Tolkien,554 To Kill a Mockingbird,Harper Lee,275 Brave New World,Aldous Huxley,287 The Great Gatsby,F. Scott Fitzgerald,228 Animal Farm,George Orwell,169 Lord of the Flies,William Golding,217 The Invisible Man,H.G. Wells,201 Hamlet,William Shakespear,89
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started