C++ exercises and solutions: Doubly Linked List-OOP


C++ OOP: Doubly Linked List

Exercise: create a doubly linked list in C++ programming language by using Object-Oriented Programming(OOP) concept.

The doubly linked list is much similar to the singly linked list, except that in the doubly linked list, we add a previous link to the element of the list. By doing this the list can be traversed forward and backward.

doubly linked list in C++

In this solution to the exercise, we are going to build a doubly linkedlist that has two pointers--one(pfirst) points to the first item of the list and another one(plast) point to the last item of the list. The program also provides a menu of choices that a user can use do some operations on the linkedlist.

doubly linkedlist operations menu in C++  

To keep the solution simple, we divide it in to different steps as you see their links on the right menu.




Comments




This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.