Question: Using C++, create a singly linked list having 5 nodes when instantiated. Please include a SinglyLinkedList.hpp, SinglyLinkedList.cpp, and main.cpp. It's ESSENTIAL this is included. Create

Using C++, create a singly linked list having 5 nodes when instantiated.

Please include a SinglyLinkedList.hpp, SinglyLinkedList.cpp, and main.cpp. It's ESSENTIAL this is included.

Create the following methods for your linked list:

1) InsertBeginning(): This function will accept a value from the user, which will be used to create a new node at the beginning of the linked list.

2) InsertEnd(): This function will accept a value from the user, which will be used to create a new node at the end of the linked list.

3) Insert(): This function will accept a value and a location from the user, and will then add a node with the provided value in the location specified by the user.

4) DeleteBeginning(): This function will delete the first node of the linked list.

5) DeleteEnd(): This function will delete the last node of the linked list.

6) Delete(): This function will take a user input specifying which node to delete.

7) View(): This function will display the linked list.

This program should be menu driven, and once it is run, it will first display the initial linked list, and then ask the user for his/her option. Something like the following:

1.insert beginning node

2.insert last node

3.insert node at position

4.Delete first node

5.Delete last node

6.Delete node at specific location

7.Exit

The options will be the functions you are going to implement. The menu should be in a loop and will only end, if the user presses the option to terminate the program.

After each operation is performed, the resulting linked list will be displayed to the user, before asking for his/her option again.

Remember to consider every possible outcome of the program, and handle it accordingly.

I'm using Xcode for this. Please display code from the compiler and the output. Thank you!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!