snlist.cpp

来自「采用模版函数对数据结构的线性列表和栈以及队列进行编程。」· C++ 代码 · 共 33 行

CPP
33
字号
#include "List\NList.h"

void main()
{
//   SNode<char> *head;
//   DNode<char> *head;
   OList<char>  head;
//   CNode<char>   *head;
   SetNull(&head);
   Insert(&head,'a',1);
   Insert(&head,'b',2);
   Insert(&head,'a',2);   
   Insert(&head,'c',4);
   Insert(&head,'d',3);
   Insert(&head,'e',1);
   Insert(&head,'f',7);
   Display(&head);
   printf("Single List length=%d\n",Length(&head));
   printf("Position:%d   Value:%c\n",3,Get(&head,3));
   printf("Value: %c  Position:%d\n",'a',Locate(&head,'a'));
   printf("Delete the first node: ");
   Delete(&head,1);
   Display(&head);
   printf("Delete the fifth node: ");
   Delete(&head,5);
   Display(&head);
   printf("Delete the three nodes from the first node: ");
   Delete(&head,3);
   Delete(&head,2);
   Delete(&head,1);
   Display(&head);

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?