stack linked list

Hi Guys,
I am new to C++ ...and need some help...
I have a stack array template class, aslo in main I created a linked list by entering numbers from a text file into the link list.

In the next step, I need to store elements from the linked list into the stack and then last step is to print the numbers from the stack array.
How can I store the numbers in the array of stack from a linked list? iny ideas??? Thanks!

1
2
3
4
5
6
7
8
9
10
void BuildStackfromLinkedList (nodeType *head)

{

	if (head !=NULL)
	{
		stack.Push (head ->info);
		head->link;

	}
Last edited on
hElP:)
What is line 8 supposed to be doing?
it's supposed to move on the stack...I changed the code a little bit

1
2
3
4
5
6
7
8
9
10
11
void ReverseLLStack (nodeType *head)

{
    nodeType *temp;
	temp = head;
	StackADT <int> stack;
	while (temp !=NULL)
	{ stack.Push (temp->info);
		temp= temp ->link;
	}
}
Topic archived. No new replies allowed.