跪求高手帮忙改下程序
多关键字排序我代码没错,就是运行不下去,高手帮忙看看,出哪了问题!!帮忙改下
#include<math.h>
#include<string.h>
#include<stdio.h>
#include<stdlib.h>
#include<malloc.h>
#define Null 0
#define r 101
typedef struct node
{
int k[6];
struct node *next;
char name;
}Rnode,*Rlink;
void Radixsort(Rlink F,int gs)/*基数排序*/
{
Rlink p,t,f[r],e[r];
int i,j;
if(F->next==Null)return;
for(i=gs;i>=1;i--)
{
for(j=0;j<=r;j++)
f[j]=Null;
p=F->next;
while(p)
{
j=p->k[i];
if(f[j]==Null)f[j]=p;
else e[j]->next=p;
e[j]=p;
p=p->next;
}
for(j=0;!f[j];j++)
F->next=f[j];
t=e[j];
while(j<r)
{
j++;
if(f[j])
{
t->next=f[j];
t=e[j];
}
}
t->next=Null;
}
}
void Linsertsort(Rnode *L,int i)
{
Rlink p,q,s,u;
p=L->next;
L->next=Null;
while(p)
{
s=L;q=L->next;
while(q&&q->k[i]<=p->k[i])
{
s=q;q=q->next;
}
u=p->next;
p->next=q;
s->next=p;
p=u;
i--;
while(i>=1)
Linsertsort(L,i);
}
}
int initl(Rnode *head)/*建立空表*/
{
head=(Rnode*)malloc(sizeof(Rnode));
if(head==Null)return 0;
head->next=Null;
return 1;
}
int Great(Rnode *head,Rnode a[],int n,int nu)/*建立链表*/
{
Rnode *p,*s;
int j,i;
if(initl(head)==0)return 0;
p=head;
for(j=0;j<=n-1;++j)
{
if((s=(Rnode*)malloc(sizeof(Rnode)))==Null)return 0;
for(i=1;i<=nu;i++)
s->k[i]=a[i].k[i];
s->name=a[i].name;
s->next=Null;
p->next=s;
p=s;
}
return 1;
}
main()
{
int num,i,numb,War;
Rnode b[1000];Rlink LB;
printf("\nPlease choose the way of problem:");/*选择方法*/
scanf("%d",&War);
printf("\nPlease input the number of student(<=1000):");
scanf("%d",&num);
printf("\nPlease input the number of school subject course(<=5):");
scanf("%d",&numb);
for(i=1;i<=num;i++)
{
printf("\nPlease input the name of student%d:",i);
getchar();
scanf("%c",&b[i].name);
if(numb>=1)
{
printf("\nPlease input the first important scorce:");
scanf("%d",&b[i].k[1]);
}
if(numb>=2)
{
printf("\nPlease input the second important scorce:");
scanf("%d",&b[i].k[2]);
}
if(numb>=3)
{
printf("\nPlease input the third important scorce:");
scanf("%d",&b[i].k[3]);
}
if(numb>=4)
{
printf("\nPlease input the fourth important scorce:");
scanf("%d",&b[i].k[4]);
}
if(numb>=5)
{
printf("\nPlease input the fifth important scorce:");
scanf("%d",b[i].k[5]);
}
}
Great(LB,b,num,numb);
while(War==1)
{
Radixsort(LB,numb);
for(i=0;i<num;i++)
{
printf("\nThe result is number %d: %s",i+1,LB->name);
LB=LB->next;
}
}
while(War==2)
{
Linsertsort(LB,numb);
for(i=0;i<num;i++)
{
printf("\nThe result is number %d: %s",i+1,LB->name);
LB=LB->next;
}
}
}