#include #include using namespace std; template class List { public: List(); ~List(); //удаление первого элемента в списке void pop_front(); //добавление элемента в конец списка void push_back(T data); // очистить список void clear(); // получить количество елементов в списке int GetSize() { return Size; } // перегруженный оператор [] T& operator[](const int index); //добавление элемента в начало списка void push_front(T data); //удаление элемента в списке по указанному индексу void removeAt(int index); private: template class Node { public: Node * pNext; T data; Node(T1 data = T1(), Node *pNext = nullptr) { this->data = data; this->pNext = pNext; } }; int Size; Node *head; }; template List::List() { Size = 0; head = nullptr; } template List::~List() { clear(); } template void List::pop_front() { Node *temp = head; head = head->pNext; delete temp; Size--; } template void List::push_back(T data) { if (head == nullptr) { head = new Node(data); } else { Node *current = this->head; while (current->pNext != nullptr) { current = current->pNext; } current->pNext = new Node(data); } Size++; } template void List::clear() { while (Size) { pop_front(); } } template T & List::operator[](const int index) { int counter = 0; Node *current = this->head; while (current != nullptr) { if (counter == index) { return current->data; } current = current->pNext; counter++; } return current->data; } template void List::push_front(T data) { head = new Node(data, head); Size++; } template void List::removeAt(int index) { if (index == 0) { pop_front(); } else { Node *previous = this->head; for (int i = 0; i < index - 1; i++) { previous = previous->pNext; } Node *toDelete = previous->pNext; previous->pNext = toDelete->pNext; delete toDelete; Size--; } } int main() { setlocale(LC_ALL, "ru"); List w; List p; int n; string word,page; cout << "Введите количество фамилий: "; cin >> n; cin.ignore(); for(int i=0;i count){ count = w[i].size(); coun = i; } } w.removeAt(coun); cout << endl; cout << "Полученный предметный указатель: " << endl; for(int i=0;i