This is what I am thinking...
Your loop condition is based on a=1 and will increment while a < size()+1.
for(int a=1;a<(S.size()+1);a++)
But my guess is.. your linked list is "zero based".. much like how an array is.. which would account for why all other elements would be deleted.. except for your very first one.. which is, "node zero" or the head node..
try this and see what happens:
for(int <strong>a=0</strong>; a<S.size()+1; a++)
Clinton Portis
Practically a Posting Shark
833 posts since Oct 2005
Reputation Points: 237
Solved Threads: 118