Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void deleteNode()
- {
- int position;
- cout << "Укажите номер участника, которого вы хотите удалить[1 - "<< size << "]: "; cin >> position;
- if (position > size)
- return;
- position--;
- if (head == NULL)
- return;
- Spisok* temp = head;
- if (position == 0)
- {
- head = temp->next;
- free(temp);
- return;
- }
- for (int i = 0; temp != NULL && i < position - 1; i++)
- temp = temp->next;
- if (temp == NULL || temp->next == NULL)
- return;
- Spisok* next = temp->next->next;
- free(temp->next);
- temp->next = next;
- size--;
- }
Add Comment
Please, Sign In to add comment