标准c++中的链表问题

[复制链接]
查看11 | 回复2 | 2009-4-15 21:04:41 | 显示全部楼层 |阅读模式
用标准c++实现链表功能,要求:节点的类型不明,能够实现插入删除查找等功能。应该如何做?

回复

使用道具 举报

千问 | 2009-4-15 21:04:41 | 显示全部楼层
#includeusing namespace std;int len=0;struct list//结构的声明{ int data; list *next;};list *head;list *create()//建立链表,这是第一步;{ list *p,*q; head=NULL; int temp; cout>temp; len=0; while(temp!=-1) {len++;p=new list;p->da...
回复

使用道具 举报

千问 | 2009-4-15 21:04:41 | 显示全部楼层
使用模板。具体可以参考stl当中的list容器。template...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行