I seem to be stuck in an endless loop here and was wondering if someone could help? I am writing this method to a linked list class. There are strings of words in a file that is read into the linked list. It needs to read the last string in the file (eg: happy) then run back through the linked list, and anything less than happy (any word starting with a-g) it will delete from the list and create a new list with the deleted nodes. I have a deleteNode method written also. Any help is appreciated!
void list::outputResult(ostream& outstream)
{
node *nodeptr;
string data;
nodeptr = head;
while(nodeptr->link != NULL)
{
nodeptr = nodeptr->link;
}
nodeptr->data;
string temps = nodeptr->data;
nodeptr = head;
while(nodeptr->link != NULL)
{
if(nodeptr->data < temps)
{
deleteNode(data);
nodeptr = head;
}
else
nodeptr = nodeptr->link;
}
}