homework simply remove
template<class List_entry>
Error_code List<List_entry>::remove(int position,List_entry&x)
{
Node<List_entry>*prior,*current;
if(count==0)return fail;
if(position<0||position>=count)return range_error;
if(position>0)
{
prior=set_position(position-1);
current=prior->next;
prior->next=current->next;
}
else
{
current=head;
head=head->next;
}
x=current->entry;
delete current;
count--;
return success;
}
浙公网安备 33010602011771号