1、include
2、 List() { head=newNode(); } ~List() { Node *p=head->next; while(p) { Node *s=p; p=s->next; free(s); } free(head); } voidinitial() { Node *zhen; zhe
3、n=head; inti; cin>>i; for(intj=0;j>s->data; zhen->next=s; zhen=s; s->next=NULL; } } intgetList_Length() { Node *ss; inti=
4、0; ss=head->next; while(ss) { i++; ss=ss->next; } returni; } intsearch(inta) { Node *find; find=head->next; if(a>this->getList_Length()||a<=0) return0; else
5、 { for(inti=1;inext; } returnfind->data; } } intInsert_List(inta,intb) { Node *Insert; Insert=head->next; if(a==1)
6、 { Node *ss=newNode(b); head->next=ss; ss->next=Insert; return1; } if(a>this->getList_Length()+1||a<=0) return0; else if(a>1) { Insert=head->next;
7、 for(inti=0;i
8、} intDelete_List(inta) { Node *find; inti; find=head->next; if(a==1) { Node *ss; ss=head->next; head->next=ss->next; free(ss); return1; } if(
9、a<=0||a>this->getList_Length())
return0;
elseif(a>1)
{
for(i=0;i
10、xt=find->next;
free(ss);
return1;
}
}
voidDisplay()
{
Node *ss;
ss=head->next;
while(ss!=NULL)
{
cout<
11、next;
}
cout< 12、ay();
}
for(i=0;i<2;i++)
{
cin>>a;
if(list.Delete_List(a)==0)
cout<<"error"<






