单链表基本操作(C++代码)..docVIP

  • 1
  • 0
  • 约6.63千字
  • 约 8页
  • 2020-07-19 发布于湖北
  • 举报
#include iostream #include stdlib.h #include assert.h using namespace std; // list node structure typedef struct _NODE{ int data; struct _NODE *next; }NODE, *PNODE; // create a list, return the pointer to the head node PNODE create() { PNODE head = NULL; PNODE current = NULL; PNODE temp = NULL; int data = 0; int cnt = 1; temp = new NODE; assert(temp != NULL); cout Please input numbers, end with 0 endl; cin data; temp-data = data; while(temp-data != 0) { if(cnt == 1) { // head node current = temp; head = current; }else{ current-next = temp; } current = temp; temp = new NODE; assert(temp != N

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档