June 23rd, 2012, 04:57 PM
Linked list input question
I'm not sure if this is correct. The input is stored in a variable and I used that variable for the linked list.
I jsut need the input in the list and then I go from there. So no deleting needed. Just the adding, I suppose.
cout << "Error: Could not open file.\n";
// linked list
void List::appendNode (string Input)
ListNode *newNode; // point to new node
ListNode +nodePtr; // to move through the list
//Allocate a new node and store input there
newNode = new ListNode;
newNode->value = string;
newNode->next = NULL;
// if no nodes in list make newNode first node
head = newNode;
//initialize nodePtr to head of list
nodePtr = head;
//find last node in List
nodePtr = nodePtr->next;
//Insert new node in the last node
nodePtr-> next = newNode;
June 24th, 2012, 05:03 AM
Re: Linked list input question
Please post compilable code that is properly indented.
Originally Posted by XodoX
Also, what is your actual question?
Cheers, D Drmmr
Please put [code][/code] tags
around your code to preserve indentation and make it more readable.
As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!