# include<iostream.h>
struct S
{
int Date;
S *next;
};
S* Head;
S *create()
{
S* PS;
S* PEnd;
PS=new S;
cin>>PS->Date;
Head=NULL;
PEnd=PS;
while(PS->Date!=0)
{
if(Head==NULL)
Head=PS;
else
PEnd->next=PS;//连接
PEnd=PS; //后挪;
PS=new S;//再分配
cin>>PS->Date;
}
PEnd->next=NULL;
delete PS;
return Head;
}
S* ShowList(S*head)
{
cout<<"shuchu\n";
while(head)
{
cout<<head->Date<<endl;
head=head->next;
}
return head ;
}
S* Shan(S* head, int DaiShanShu) //删除连表
{
S* P;
if(!head)
{
cout<<"不能删除,因为连表为0:\n";
}
if(head->Date==DaiShanShu)
{
P= head;
head=head->next;
delete P ;
}
for( S* G=head;G->next;G=G->next)
{ //另外G->next这个代表什么意思,我第一次看到这中形式
if(G->next->Date==DaiShanShu)
{
P=G->next;
G=G->next->next;
delete P;
cout<<DaiShanShu<<"被删除:\n";
}
}
return head ;
}
void main()
{
S* M;
S* N;
M=create();
ShowList(M);
N=Shan(M,100);
ShowList(N);
return ;
}
那里出了问题,请大家帮我修改以下,谢谢