#include <iostream>
#include <stdlib.h>
using namespace std;
typedef struct LNode
{
int data;
struct LNode *next;
}LNode;
LNode * createLinkList() //构造带头结点的链表 ,尾插法,构造的节点要有序
{
int num=0;
LNode *head=(LNode *)malloc(sizeof(LNode));
head->next=NULL;
cout<<"输入节点的个数(不包含头结点):"<<"\n";
cin>>num;
LNode *r=head;
cout<<"输入节点的值:";
for(int i=0;i<num;i++)
{
LNode *p=(LNode *)malloc(sizeof(LNode));
p->next=NULL;
r->next=p;
r=p;
cin>>p->data;
}
return head;
}
void printLinkList(LNode *p) //输出节点的值域信息
{