Trying to complete a linked list (implementation file)?

Here's what I'm given:
**********
struct Node
{
void* data_;
Node* prev_;
Node* next_;

Node()
{
data_ = 0;
prev_ = 0;
next_ = 0;
}

~Node()
{
if (data_ != 0)
{
delete data_;
}
}
};

class LinkedList
{
private:
Node* first_;
Node* last_;
long listLen_;

public:
LinkedList();
~LinkedList();
void AddLinkToBack(void* ptr);
void* RemoveThisLink(Node* node);
void* RemoveLinkFromFront();
Node* GetFirstNode();
long GetListLength();
};
********
I'm simply trying to implement the functions, how might I go about it (I'm trying to modify some <list> examples that DID work)?

#include "LinkedList2.h"
#include<iostream>
#include<list>

void LinkedList::AddLinkToBack
{
list<int> mylist;
int myint;

cout << "Please enter some integers (enter 0 to end):\n";

do {
cin >> myint;
mylist.push_back (myint);
} while (myint);

cout << "mylist stores " << (int) mylist.size() << " numbers.\n";

return 0;
}

void LinkedList::RemoveThisLink
{
int myints[]= {17,89,7,14};
list<int> mylist (myints,myints+4);

mylist.remove(89);

cout << "mylist contains:";
for (list<int>::iterator it=mylist.begin(); it!=mylist.end(); ++it)
cout << " " << *it;
cout << endl;

return 0;
}

void LinkedList::RemoveLinkFromFront
{
list<int> mylist;
mylist.push_back (100);
mylist.push_back (200);
mylist.push_back (300);

cout << "Popping out the elements in mylist:";
while (!mylist.empty())
{

cout << " " << mylist.front();
mylist.pop_front();
}

cout << "\nFinal size of mylist is " << int(mylist.size()) << endl;

return 0;
}
Topic archived. No new replies allowed.