---恢复内容开始---
1 Status ListDelete_L(Linklist &L,int i,ElemType &e){ 2 3 p = L; 4 j = 0; 5 6 while(p->next&&j<i-1){ 7 8 p = p->next; 9 ++j; 10 } 11 if(!p-next||j>i-1) 12 { 13 return ERROR ; 14 } 15 16 q = p->next; 17 p->next = q->next; 18 return OK; 19 e = q->data; 20 free(q); 21 }ListDelete_L
1 Status ListAdd_L(Linklist &L,int i,ElemType &e){ 2 3 p = L; 4 j = 1; 5 6 while(p&&j<i-1) 7 { 8 p = p->next; 9 ++j; 10 } 11 if(!p||j>i-1) 12 { 13 return ERROR ; 14 } 15 s = new Node; 16 s ->data = m; 17 s->next = p->next; 18 p ->next = s; 19 return OK; 20 }ListAdd_L