# include
#include
# define MaxSize 50
Typedef char ElemType;
Typedef struct
{
ElemType data [MaxSize];
int length;
} SqList;
Void CreateList (SqList * & amp; L, ElemType a [], int n)
{
L=(SqList *) malloc (sizeof (SqList));
for(int i=0; iL-> Data=[I] a [I];
L-> Length=n;
}
Void InitList (SqList * & amp; L)
{
L=(SqList *) malloc (sizeof (SqList));
L-> Length=0;
}
Void DestroyList (SqList * & amp; L)
{
free(L);
}
Bool ListEmpty (SqList * L)
{
Return (L - & gt; Length==0);
}
Int ListLength (SqList * L)
{
Return (L - & gt; Length);
}
Void DispList (SqList * L)
{
for(int i=0; iLength; I++)
Printf (" % c ", L - & gt; Data [I]);
printf("\n");
}
Bool GetElem (SqList * L, int I ElemType & amp; E)
{
If (i<1 | | i> L-> Length)
return false;
E=L - & gt; Data [I - 1);
return true;
}
Int LocateElem (SqList * L, ElemType e)
{
Int I=0;
while(iLength & amp; & L-> Data [I]!=e)
i++;
If (i>=L - & gt; Length)
return 0;
The else
Return the I + 1;
}
Bool ListInsert (SqList * & amp; L, int I ElemType e)
{
int j;
If (i<1 | | i> L-> Length + 1)
return false;
i--;
For (j=L - & gt; Length; J> 1; J -)
L-> Data [I]=L - & gt; Data [1];
L-> Data [I]=e;
L-> Length++;
return true;
}
Bool ListDelete (SqList * & amp; L, int I ElemType & amp; E)
{
int j;
If (i<1 | | i> L-> Length)
return false;
i--;
E=L - & gt; Data [I];
For (j=I; L-> Length - 1. J++)
L-> Data [j]=L - & gt; Data [j + 1);
L-> Length -;
return true;
}
# include "sqlist. CPP
"Int main ()
{
SqList *L;
ElemType e;
Printf (" order form basic operation is as follows: \ n ");
Printf (" (1) the initialization sequence table L \ n ");
InitList(L);
Printf (" (2), in turn, insert a, b, c, d, e element \ n ");
ListInsert (L, 1, 'a');
ListInsert (L, 2, "b");
ListInsert (L, 3, "c");
ListInsert (L, 4, 'd');
ListInsert (L, 5, 'e');
Printf (" (3) the output sequence table L: "); DispList(L);
Printf (" (4) the sequence table L length: % d \ n ", ListLength (L));
Printf (" (5) the order table L for % s \ n ", (ListEmpty (L)?" Empty ":" not null "));
GetElem (L, 3, e);
Printf (" the third element (6) sequence table L: % c \ n ", e);
Printf (" the position of the element (7) a: % d \ n ", LocateElem (L, 'a'));
Printf (" (8) in the fourth element position insert element f \ n ");
ListInsert (L, 4, 'f');
Printf (" (9) the output sequence table L: "); DispList(L);
Printf (" the third element (10) delete L \ n ");
ListDelete (L, 3, e);
Printf (" (11) the output sequence table L: "); DispList(L);
Printf (" (12) to release order table L \ n ");
DestroyList(L);
return 1;
}
Does anyone know how to return a responsibility, how to solve