Question
C++ PROGRAMMING: Implement a linked list class to hold a series of names (strings). The class should have member functions for appending, deleting, and inserting
C++ PROGRAMMING:
Implement a linked list class to hold a series of names (strings). The class should have member functions for appending, deleting, and inserting nodes. Your task is to complete the program below, fix any errors along the way (there are some syntax errors already), verify that it prints what you expect to print. Submit your '.cpp' file and screenshots of output.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#includeusing namespace std; class MyOwnLinkedList { private: // Declare structure with name OneNode struct OneNode { // your variables (ToDo) }; // Define your head pointer (ToDo) public: // Constructor(ToDo) // Destructor (ToDo) // Methods to be implemented (ToDo) // append at the end (ignoring the alphabetical order) void appendNode(string); // this will insert assuming that alphabetical order is to be maintained void insertNode(string); // should print valid message if name does not exist void deleteNode(string); // print all names void displayWholeList() const; } int main () { MyOwnLinkedList l; l.appendNode("B"); l.appendNode("C T"); l.appendNode("D D"); l.insertNode("A"); l.insertNode("A A"); l.deleteNode("X"); l.deleteNode("A"); l.displayWholeList(); return 0; }
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