Курсовая работа: Односвязный список на основе указателей
Insert(Query, Pointer->pNext);
}
}
void List::Print(Node *Pointer) const {
if (Pointer == NULL)
return;
cout<<"Name: "<<Pointer->Name<<"";
cout<<"Price: "<<Pointer->Price<<"";
cout<<"Number: "<<Pointer->Number<<"\n";
Print(Pointer->pNext);
}
void List::Remove(char *Query) {
if (pHead == NULL) {
cout<<"The list is already empty\n";
return;
}
Node *pPrev = pHead;
Node *pTemp = pHead->pNext;
if (strcmp(Query, pHead->Name) == 0) {
pTemp = pHead;
pHead = pHead->pNext;
delete pTemp;
cout<<"Entry removed successfully\n";
return;
}
while (pTemp != NULL) {
if (strcmp(Query,pTemp->Name)==0)
break;
pPrev = pTemp;