Курсовая работа: Односвязный список на основе указателей
return pHead;
}
void List::Insert() {
if (pHead == NULL) {
pHead = new Node;
assert(pHead != NULL);
pHead->pNext = NULL;
pTail = pHead;
}
else {
pTail->pNext = new Node;
assert(pTail->pNext != NULL);
pTail = pTail->pNext;
pTail->pNext = NULL;
}
}
void List::Insert(char *Query, Node *Pointer) {
int Match;
Node *pNewNode;
if (Pointer == NULL) {
cout<<"No match found\n";
return;
} else {
Match = strcmp(Query, Pointer->Name);
if (Match == 0) {
pNewNode = new Node;
assert(pNewNode != NULL);
pNewNode->pNext = Pointer->pNext;
Pointer->pNext = pNewNode;