中国铁道建设出版
else { pend->next=p ; pend=p ; }
cout<<"请输入数据(为零表示结束输入):" ;
cin>>a;
}
if(head) pend->next=0 ;
return head ;
}
node * invert(node *head)
{
node *p,*q;
p=head->next;
if(p!=NULL)
{
head->next=NULL;
do
{
q=p->next;
p->next=head;
head=p;
p=q;;
}while(p!=NULL);
}
return head;
}
void print(node *head )
{
if(head==0) { cout<<" 链表为空!\n" ; return ; }
node *p=head ;
cout<<"链表上各个结点的值为:\n";
while(p!=0)
{
cout <<p-> data<<'\t' ;
p=p->next ;
}
}
void release(node *head )
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说教育文库C++教材练习题参考答案(18)在线全文阅读。
相关推荐: