Looks to me like no new nodes are created in this loop:
while(!ins.eof())
{
ins >> temp->base;
temp->next = NULL;
if (head == NULL)
head = temp;
else
{
node* z;
z = head;
while (z->next != NULL)
{
z = z->next;
}
z->next=temp;
}
}
You are just continually putting a new value into temp->base and overwriting the old value. As for the infinite loop, I haven't tested it out, but I'm guessing that temp == temp->next and possibly head == temp. You need to create a new node every time you read a new value from the input file.
VernonDozier
Posting Expert
5,527 posts since Jan 2008
Reputation Points: 2,633
Solved Threads: 711