程序错误比较多.希望各位帮助修改一下???
程序是将递增的两个线性表合并成另一个线性表,
如果你有更好的程序也可以发上来,谢谢了...
#include <stdio.h>
#define LIST_INIT_SIZE 100
void main()
Typedef struct{
ElemType *Elem;
int length;
int listsize;
}Sqlist;
void MergeList_Sq(SqList La,SqList Lb,SqList&Lc)
{
for(int i=1;i<=La.length;i++)
scanf("%d",&La);
for(int j=1;j<=Lb.length;j++)
scanf("%d",&Lb);
pa=La.elem;pb=Lb.elem;
Lc.listsize=Lc.length=La.length+Lb.length;
pc=Lc.elem=(ElemType*)malloc(Lc.listsize*sizeof(ElemType));
if(!Lc.elem)exit(OVERFLOW);
pa_last=La.elem+La.length-1;
pb_last=Lb.elem+Lb.length-1;
while(pa<=pa_last&&pb<=pb_last)
{
if(*pa<=*pb) *pc++=*pa++;
else *pc++=*pb++;
}
while(pa<=pa_last) *pc++=*pa++;
for(int k=1;k<=Lc.length;k++)
printf("%d",Lc);
}