半夜写程序写不通啊跪求大神指点下小弟我错哪了!明天要交的

半夜写程序写不通啊。。。。跪求大神指点下我哪里错了!!!明天要交的
输入一个字符串,将其中地字母 字符 链入一个线 性列表,将数字 字符链入 另一个线性链表,要求程 序能够 1 按字典 顺序 输出 字母线性 列表中的元素,2 按照 由小 到大 的顺 序 输出 数字 线性 列表 中的 元素


#include<iostream>
using namespace std;

typedef struct LNode//定义结点
{
char data;
struct LNode *next;
}


LNode,*Linklist;
LNode *r;
LNode *p,*q;


void insertNode(Linklist &L,char e )//插入结点
{
q->data=e;
q->next=L;
p->next=L;
while(p->next->next->data<'e' && p->next->next!=NULL)
q->next=p->next->next;
p->next=q;

}
void outNode(Linklist &L)//输出结点
{

r->next=L;
while(r!=NULL)
{
cout<<r->data;
r->next=r->next->next;
}
}



int main()
{


cout<<"请输入字符串,必须为数字或者字母:";

Linklist list1,list2;//定义两个带头结点的链表
list1=(Linklist) malloc (sizeof(LNode));                
    list2=(Linklist) malloc (sizeof(LNode));                

    list1->next=NULL;
    list2->next=NULL;

while(cin)
{
char ch;
cin>>ch;
if('0'<=ch&&ch<='9')
insertNode(list1,ch);
else if('a'<=ch&&ch<='z'||'A'<=ch&&ch<='Z')
insertNode(list2,ch);
else
{
cout<<"you put wrong";
return 0;
}

}
outNode(list1);
cout<<'\n';
outNode(list2);
return 1;

}

------解决方案--------------------
断点跟踪一下看看报啥错?
------解决方案--------------------
21行 'e'是怎么回事?