#include#include #includeusing namespace std;
typedef struct list//鍊錶資料結構體
list ;
list* head = new list;//定義乙個鍊錶的頭
list* end = new list;//定義乙個鍊錶的尾
void addlist()//向鍊錶中按從小到大的順序新增乙個資料
else
p->next = r;
l->next =p;
p = null; }}
void paintlist()//輸出鍊錶
cout<>m;
while( !(m == p->next->data || null == p->next->next) )
if(m == p->next->data)
else
system("cls");
}while(i != 0);
}void main()
執行結果:
(資料已經輸入,這張是列印出的鍊錶)
c 鍊錶簡單實現
鍊錶 include using namespace std template struct node template class linklist public linklist node p new node head p p next null node push front const t...
C 簡單鍊錶操作
include include include 定義乙個數字節點 typedef struct tagstnode stnode 建立inum個節點,返回指向第乙個節點的指標 stnode create int inum 列印 void print stnode psthead 將鍊錶反轉 stno...
c 簡單鍊錶實現
以下為linklist.件 ifndef linklist h included define linklist h included typedef structlnode lnode,plinklist classlinklist endif linklist h included 以下為lin...