#include <stdio.h>
#include <stdlib.h>
#define MAXSIZE 5
typedef int ElemType;
typedef struct{
ElemType *elem;
int length;
}SqList;
void InitList(SqList &L);/*细节在此不表*/
int ListInsert(SqList &L,int i,ElemType e);
//插入元素
int ListInsert(SqList &L,int i,ElemType e)
{
if(i<=0||L.length+1<i||L.length>=MAXSIZE) return 0;
for(int j=L.length-1;j>=i-1;j--)
{
L.elem[j+1
L.elem[i-1]=]=L.elem[j];
}e;
L.length++;
return 1;
}
//链表的删除操作
int ListDelete(SqList &L,int i)
{
if(L.length<i||i<=0)
return 0;
int j;
if(i==L.length) {L.elem[i-1]=NULL;L.length--;return 1;}
for(j=i-1;j<L.length;j++ )
{
L.elem[j]=L.elem[j+1];
}
L.length--;
return 1;
}
//顺序表的有序插入
int SqInsert(SqList &L,ElemType e)
{
int i;
if(L.length==MAXSIZE) return 0;
for(i=L.length-1;i>=0;i--)
{
if(L.elem[i]>=e)
{
L.elem[i+1]=L.elem[i];
}else break;
}
L.elem[i+1]=e;
L.length++;
return 1;
}
int main()
{
SqList L;
InitList(L);
ElemType e;
int i;
scanf("%d%d",&i,&e);
int result=ListInsert(L,i,e);
if(result==0){
printf("Insertion Error.The value of i is unlawful or the storage space is full!");
}else if(result==1){
printf("Insertion Success.The elements of the SequenceList L are:");
for(int j=0;j<L.length;j++){
printf(" %d",L.elem[j]);
}
}
return 0;
}
/* 请在这里填写答案 */