高手帮忙指点一下,一个链表问题
#include<iostream>
#include<stdlib.h>
#include<conio.h>
using namespace std;
typedef struct LNode{
int data;
struct LNode *next;
}LNode,*Linklist;
int CreateList(Linklist &L,int n)
{ Linklist p;int i;
L=(Linklist)malloc(sizeof(LNode));
L->next==NULL;
for(i=1;i<=n;i++)
{p=(Linklist)malloc(sizeof(LNode));
cin>>p->data;L->next=p;p->next=L->next;}
int ListDelete(Linklist &L,int i,int &e)
{ Linklist q, p;p=L;int e,j=0;
while(p->next&&j<i-1)
{p=p->next;j++;}
if(!(p->next)||j>i-1) return 0;
else q=p->next;p->next=q->next;
e=q->data;free(q);
return 1;
}
void main()
{ int a,b,c,i,j;
Linklist L p,q;q=p=L;
cout<<"please enter the len of the list:";
cin>>a;
cout<<endl<<"please enter the datas:";
CreateList(L,a);
cout<<"the list is:"
for(i=0;i<a;i++)
{cout<<p->data;p=p->next;}
cout<<"enter the weizhi dele:";
cin>>b;
ListDelete(L,b,c);
for(j=0;j<a-1;j++)
{cout<<q->data;q=q->next);}
cout<<endl<<c;}
为和编译通不过呢,谢谢!