请问这该怎么做?数据结构链表

//补充程序,完成一个插入一个节点,并且链表仍然有序

#include

using namespace std;

typedef struct LNode

{

 int   data;       //数据域

 struct LNode  *next;   //指针域

}LNode,*LinkList;

void CreateList_F(LinkList &L){

  int i;LinkList p,r;

L=new LNode;

  L->next=NULL; //先建立一个带头结点的单链表 

  r=L;

  cin>>i;

  while(i!=999){ 

    p=new LNode; //生成新结点 

    p->data=i; //输入元素值 

    r->next=p;

r=p;

cin>>i;

 } 

p->next=NULL;

}//CreateList_F

int ListInsert_L(LinkList &L){

//插入新的节点,并且链表仍然有序

}//ListInsert_L

int ListShow(LinkList L)

{LinkList p;

if(L->next==NULL) return 0;

p=L->next;

while(p)

{cout<data<<" ";

p=p->next;

}

}

main()

{LinkList head,head1;

cout<<"建立链表:"<<endl;

CreateList_F(head);

ListShow(head);cout<<endl;

}

int ListInsert_L(LinkList &L){
LinkList p,q;
p=new LNode;
cin>>p->data;
p->next = NULL;
q = L;
while(q->next != NULL)
{
      if(q->next->data > p->data)
      {
            p->next = q->next;
            q->next = p;
      }
      q = q->next;
}
if(q->next == NULL)
        q->next = p;
return 0;
}

供参考:

#include <iostream>
#include <windows.h>
using namespace std;
typedef struct LNode
{
    int    data;       //数据域
    struct LNode  *next;//指针域
}LNode,*LinkList;
void CreateList_F(LinkList &L)
{
    int i;LinkList p,r;
    L=new LNode;
    L->next=NULL; //先建立一个带头结点的单链表
    r=L;
    cin>>i;
    while(i!=999){
         p=new LNode; //生成新结点
         p->data=i; //输入元素值
         r->next=p;
         r=p;
         cin>>i;
    }
    p->next=NULL;
}//CreateList_F

int ListInsert_L(LinkList &L) //插入新的节点,并且链表仍然有序
{
     LinkList pL = NULL,q = NULL;
     if (L == NULL) return 0;
     q = new LNode;
     q->next = NULL;
     cin>>q->data;
     pL = L;
     while(pL->next && pL->next->data < q->data)
          pL = pL->next;
     q->next = pL->next;
     pL->next = q;
     return 1;
}//ListInsert_L

int ListShow(LinkList L)
{
    LinkList p;
    if(L->next==NULL) return 0;
    p=L->next;
    while(p)
    {
        cout<<p->data<<" ";
        p=p->next;
    }
}

main()
{
    LinkList head,head1;

    cout<<"建立链表:"<<endl;
    CreateList_F(head);
    ListShow(head);cout<<endl;
    
    ListInsert_L(head); //插入新的节点
    ListShow(head);cout<<endl;

    system("pause");
}