#include
#include
typedef int type;
typedef struct {
type * elem;
int length;
int listsize;
}Sqlist;
int initlist(Sqlist &l)
{
l.elem=(type *)malloc(100*sizeof(type));
if(!(l.elem)) exit(0);
l.length=0;
l.listsize=100;
return 1;
}
void input(Sqlist &l,int n)
{
type *p;
l.length=n;
for(p=l.elem;p
scanf("%d",p);
}
void inset(Sqlist &l,int t,type x)
{ type *p,*q;
if(t<1&&t>l.length+1) exit(0);
p=l.elem+l.length;
for(q=l.elem+t-1;p>q;p--)
*p=*(p-1);
*q=x;
(l.length)++;
}
void dele(Sqlist &l,int t)
{ type *p,*q;
for(p=l.elem+t-1,q=l.elem+l.length-1;p
*p=*(p+1);l.length--;}void output(Sqlist l){type *p,*q;for(p=l.elem,q=l.elem+l.length;pprintf("%d ",*p);printf("\n");}void hebing(Sqlist la,Sqlist lb,Sqlist &lc){type *p,*q,*r;initlist(lc);lc.length=la.length+lb.length;p=la.elem;q=lb.elem;r=lc.elem;while(p if(*p<=*q) {*r=*p;r++;p++;}else {*r=*q;r++;q++;}while(p { *r=*p;r++;p++;}while(q { *r=*q;r++;q++;}}void main(){int n,i,m;type x;Sqlist l,l1;while(scanf("%d",&n)!=EOF){initlist(l);input(l,n);printf("输入要插入的位置和数\n");scanf("%d%d",&i,&x);inset(l,i,x);output(l);printf("输入要删除的位置\n");scanf("%d",&i);dele(l,i);output(l);printf("输入要合并的数组:\n");scanf("%d",&m);initlist(l1);input(l1,m);Sqlist l2;hebing(l,l1,l2);output(l2);}