Convert the linked list class given in Chapter 13 or the linked list class
given during lecture to a template class that can store data of any type,
not just integers. Also convert the following functions to functions that
take a template class: head_insert
, insert
,
search
, find_prev
and delete
. You
may also wish to add template functions to print a linked list and to delete
an entire linked list to make the program code simpler.
Create a menu driven program to test this templated linked list. Your menu should resemble the following:
Welcome to the CS222 Homework 4 Menu ===================================================== 1. Create a linked list of integers 2. Create a linked list of doubles 3. Create a linked list of characters 4. Print all linked lists 5. Delete an integer from the integer linked list 6. Delete a double from the double linked list 7. Delete a character from the character linked list 0. Exit =====================================================Note: There will be three seperate linked lists tracked by this program, one each for integer, double and character.
For Options 1 through 3, if that particular linked list already exists (i.e. if head != NULL for that list), then the entire list should be deleted and a new list created from the entered data. These options should first prompt the user for the number of integers/doubles/characters they wish to enter, then prompt the user for the data.
Option 4 should print all three lists. Your print routine should either print a blank line or skip the list if it is currently empty.
Options 5 through 7 requires the search function be operational before the delete function can work. If the search returns NULL (i.e. "not found"), print a message that the integer/double/character was not found and do NOT call delete. Otherwise, print a message that the integer/double/character was deleted.