template
void TLinkList::Input()//input function
{TNode *current=m_first->next,*p;
T x,n;
cout<<"input the length of the list"<
cin>>n;
for(int i=1;i<=n;i++)
{
cout<<"input the data of the no."<
cin>>x;
p=new TNode(x);
p=current->next;
current=current->next;
}
current->next=NULL;
}

我想知道这个单链表输入函数有什么错,总是跳出。。。
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
5条回答 默认 最新
- threenewbee 2015-10-23 16:18关注
p=current->next;
写反了
current->next = p;本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报