template struct ListNode{ ListNode *next; E element; }; template class List{ ListNode header; ListNode *current; int index; public: List(){GotoBeginning();} void GotoBeginning(){current=&header;index=0;} int AtEnd(){if (current->next==NULL) return 1; else return 0;} E Get(){return current->next->element;} void GotoNext(){current=current->next;index++;} void GotoEnd(){while (!AtEnd()) GotoNext();} int GotoIndex(unsigned int i){ GotoBeginning(); while(index *tmp=current->next; current->next=new ListNode; current->next->next=tmp; current->next->element=element; } void Delete(){ ListNode *tmp=current->next; current->next=current->next->next; delete tmp; } void Print(){ GotoBeginning(); while (!AtEnd()){ cout << index << " " << Get() << '\n'; GotoNext(); } } };