#ifndef GLIST_CPP #define GLIST_CPP #include #include #include "string.h" void list :: Clear() { block *tmp,*tmp1; for( tmp=root,tmp1=root->next;tmp1!=NULL;tmp=tmp1,tmp1=tmp1->next) delete tmp; delete tmp; size=0; } list::list () { root=tail=NULL; size=0; } list::~list () { block *tmp,*tmp1; for( tmp=root,tmp1=root->next;tmp1!=NULL;tmp=tmp1,tmp1=tmp1->next) delete tmp; delete tmp; size=0; } void list::AddToEnd(block *Nblock) { if(root==NULL) root= tail=Nblock; else { tail->AddAfter(Nblock); tail=Nblock; } size++; } void list ::AddToFront(block* Nblock) { if(root==NULL) root= tail=Nblock; else { root->AddBefore(Nblock); root=Nblock; } size++; } int list::del(){} void list :: print() { block *tmp; for( tmp =root; tmp!= NULL; tmp=tmp->next) tmp->show(); } void list:: print_i(int i) { int k; block *tmp; tmp=root; for (k=0; knext; tmp->show(); // delete tmp ; } block* list::return_i(int i) { int k; block *tmp; tmp=root; for (k=0; knext; if(tmp==NULL) break; } return tmp; } #endif