[求助]帮忙高手们进来填一下这个程序哈!!!
2、下面是设计链表类,请按要求补充成员函数中的空。class CList;
class CItem
{ public:
friend class CList;
private:
CItem(int d1,int d2){x=d1;y=d2; next=NULL;}
unsigned int x,y;
CItem *next;
};
class CList
{ public:
CList(){head=NULL;}
CItem * append(unsigned int d1,unsigned int d2);
~CList();
private:
CItem *end();
CItem *head;
};
CItem * CList::end()//返回链表的最后一个节点的地址
{ CItem *prev,*pt;
Prev=pt=head ;
while (pt)
{ prv=pt ;
__________________________//下一个节点
}
__________________________
}
CItem * CList::append(unsigned int d1,unsigned int d2)
{//将新的节点添加到链表的前端
CItem *pt = ___________________//产生新的节点并且会成功
if ( head ==NULL )
________________________________//这两句把节点添加到
else
_________________________________//链表末尾
return pt ;
}
CList::~CList( )
{ CItem *pt;
pt=head;
while (pt)
{
head=pt->next;
___________________________
___________________________
}
}