Here is the whole project, in a zip file. I'm having trouble getting the delete function to work. I can delete head just fine, but when I try to delete either something at the end, or something in the middle, it does not work out. I'm sure it has something to do with my logic being off, and what i'm showing you is a recent edit, so it might be worse than what it was.
template <class LE>
void List<LE>::remove () // Remove element
{
ListNode<LE> *temp = head;
if (!empty())
{
if(cursor == head) //case 1 corpse = head
{
head = head -> next;
delete temp;
}
else if(cursor -> next == NULL) //case 2 corpse is at the end
{
while (temp -> next -> next != NULL)
temp = temp -> next;
temp = temp -> next;
temp -> next = NULL;
delete cursor;
delete temp;
cursor = head;
}
else //case 3 corpse is in middle somewhere
{
while (temp -> next != cursor)
temp = temp -> next;
temp -> next = cursor -> next;
delete cursor;
delete temp;
cursor = head;
}
}
}