Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
i been given this task too do but have no idea where to start or how to do it...any one offer any hints? Thanks :)
The first prototype implementation you need to create is based on a doubly linked list storing
single integer values in each cell.
Your Doubly Linked List class must include the following methods:
List(); Default constructor creating an empty list.
List(n, e); Constructor creating a list of n copies of element e.
~List(); Destructor destroying all elements and freeing
memory.
size(); Returns the number of elements in the list.
empty(); Returns True if empty, False otherwise.
clear(); Removes all elements from the list.
assign(n, e); Replaces existing elements with n copies of element e.
operator=() Overloading of the assignment operator
(e.g. CList1 = Clist2)
front(); Returns reference to the first element.
back(); Returns reference to the last element.
push_front(e); Adds element e to the front of the list.
pop_front(); Removes the first element of the list.
push_back(e); Adds element e to the end of the list.
pop_back(); Removes the last element of the list.
insert(iter, e); Inserts a copy of element e at iter position in the
list, and returns a reference to its position.
erase(iter); Removes element at iter, and returns a reference
to the next position in the list.
remove(e); Removes all the elements from the list with value e.

If you have no idea where to start or how to do it, I would guess that you haven't been paying attention in class and/or have been posting on forums like this to have others do your homework. So my suggestion is that you start paying attention in class, tho if you are on double linked lists, you probably have missed enough that you'll need to start over.
If you are content to go thru life letting others do you work for you, there are plenty of sites that provide C/C++ code.

I agree with Don and Kev, you sound like you are too far behind.
I'll point out that in C++ any linked list implementation S/B templatized so objects of any type can be handled.
I'd suggest you do some searching on google, there is linked list sample code available (some of it not very good).
G.

![]() |
pascal string formatting
|
Package and Deployme
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |