Problem Statement:
This program will read books from an input file into your library data structure. A library consists of a list of books that can be in sorted or unsorted order.
As books are read in from the input file, just add them to an internal array that holds books. You will provide two methods on this Library for sorting books after they are read in from the data file. One sort function should sort by the publication year of the books.
The other should sort by the author of the book. One of your sorts should be written using SELECTION SORT. The other should be written with MERGESORT. You must write your own sort code. Do not use any built in C++ libraries for sorting.
Requirements:
You must be able to add books to your Library using an add method.
You must be able to sort your books in two manners using appropriate methods.
You must be able to display the books in the library after sorting using a print or display method.
You are not required to delete books from the list.
You must prompt the user for the name of an input file to read the books from.
Your list must be able to store at least 100 books. (Use arrays, not linked lists, - so that you can write a mergesort).
You may display your lists to the screen or to an output file. It is your choice. If you use an output file, allow the user to enter the name of the file.
Sample Output:
We The Living
Rand, Ayn
1936
The Sparrow
Russell, Mary Doria
1996
Foundation
Asimov, Isaac
1951
Hyperion
Simmons, Dan
1989
The Fifth Season
Jemison, N. K.
2015
Kindred
Butler, Octavia
1979
Watership Down
Adams, Richard
1972