Code:
void CDeck::insert(int index, s_card c)
{
if(empty()||index==1)
{
insertAtHead(c);
}
else
{
cardNodeptr cur = head;
int nodenum = 1;
while(cur != NULL && nodenum < index)
{cur = cur->next;}
nodenum++;
}
}
Well, this function doesn't do anything useful in the else part...
It's purpose is also a little vague: I suppose it is meant to change the contents of node at index, except if index is 1 and the list is empty it does the same thing as insertAtHead? This is probably not the kind of behaviour one would expect from a function called insert (which might be expected to insert new nodes into the list).
------------
If you want index-based (random) access to contents, a linked list is not a suitable container. That's what arrays and std::vector are for.
---------------
It is also not that good an idea to implement something low level like a linked list in a class that has high-level tasks (such as CDeck). Consider this: normally a program has several classes that contain some kind of list (or lists) of data. Would you think it is wise to implement a linked list from scratch for all of them?
Instead CDeck might use a suitable container to hold its card data (as a private member), and concentrate only on its real tasks, such as shuffling etc.