I'm creating a programme that needs to read data from a spreadsheet in CSV form and assigns it to a doubly linked list in C++.I have created a singly linked list but I'm at a loss as to how to use this idea to make a doubly linked list. I understand you require a previous pointer but I am unsure as to actually implementing the code.
code for my singly linked list: to add to the list:
if (!m_head)
{
m_head = new Node(name, reference,latitude,longitude);
}
else
{
Node *current = m_head;
while (current->getNext() != 0)
{
current = current->getNext();
}
current->setNext(new Node(name, reference,latitude,longitude));
}
please note: Node is a separate class to store data about the node e.g. name.