- 2
- 0
- 约2.78千字
- 约 7页
- 2021-02-24 发布于山东
- 举报
// \*********** /*---------
用 C++编写一个双链表的程序 ***********/ //
本文可以帮助大家快速的学习如何建立双向链表, 以及对双向链表进行的相关
操作
,比如删除节点、 插入节点、链表排序、计算链表长度、 打印双向链表等操作 ---------
*/
#include iostream
using namespace std;
定义双向链表的节点
typedef struct student
{
int data;
struct student *pre;
struct student *next;
}dnode;
建立双向链表
dnode *creat()
{
int cycle = 1;
int x;
dnode *head, *t, *s=NULL;
head = new dnode;
t = head;
while (cycle)
{
cout Please input a int type number: endl;
cin x;
if (x != 0)
{
s = new dnode;
s-data = x;
t-next = s;
s-pre = t;
t = s;
}
else
cycle = 0;
}
head = head-next;
head-pre = NULL;
t-next = NULL;
co
您可能关注的文档
最近下载
- 公司理财罗斯中文版13.pdf VIP
- (高清版)DB11∕T 491-2024建筑轻质板隔墙施工技术规程.pdf VIP
- 第一单元 子项目1 认识山东的自然资源(教学设计)山东地方课程五年级全一册.pdf
- 我国养老体制改革的历程与趋势研究.docx VIP
- 中兴 ZXV10 B860AV2.1U装维手册.pdf VIP
- 初中英语说课全英文ppt课件ppt课件.pptx VIP
- 社会稳定风险评估专家库管理使用办法.docx
- 《初识青铜器》课件 2026秋人教版美术四年级上册.ppt
- 西南13J106 居住建筑节能构造图集.pdf VIP
- 冷卷圆柱螺旋弹簧技术条件 第2部分:压缩弹簧.pdf VIP
原创力文档

文档评论(0)