Description
What Should This Program Do?
Linked List Class
- Design your own linked list class (List.h) to hold a series of strings.
- The linked list node should be implemented as a struct.
- The class should have member functions for appending, inserting, and deleting nodes.
- You should also have a display function that will traverse the list & display each node’s value.
- Don’t forget to add a destructor that destroys the list.
DRIVER – Lab5.cpp
Write a driver program (Lab5.cpp) that will do the following:
- Create a linked list object
- Call the linked list’s append function to append the following strings to your linked list. Afterwards, print to the screen to tell the user that you are inserting several strings to the list.
- “boogeyman”
- “ghost”
- “scarecrow”
- “witch”
- “zombie”
- Now call the linked list’s display function to print the list.
- Now call the linked list’s insert function to insert the “vampire” string in the correct sorted position. Print to the screen to tell the user that you are inserting “vampire” in to the list.
- Now call the linked list’s display function again to print the list.
- Now call the delete function to delete “ghost” from the list. Print to the screen to tell the user that you are deleting “ghost” from the list.
- Last, call the linked list’s display function again to print the list.
Sample Output
The linked list has been created.
I am appending several strings to the list.
boogeyman
ghost
scarecrow
witch
zombie
I am inserting vampire in the list.
boogeyman
ghost
scarecrow
vampire
witch
zombie
I am deleting ghost from the list.
boogeyman
scarecrow
vampire
witch
zombie
All list nodes have been removed.
What to Turn In
- List.h
- Lab6.cpp