用C编写的双向链表程序示例.docxVIP

  • 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

文档评论(0)

1亿VIP精品文档

相关文档