Home > Back-end >  Topic: with the linear table,2,3,4,5,6,7,8,9,10 (1) as the test data, please write the main function
Topic: with the linear table,2,3,4,5,6,7,8,9,10 (1) as the test data, please write the main function

Time:10-07

# include
# include
# include
# define MaxSize 100
typedef int ElemType;
Typedef int the Status;
Typedef struct
{
ElemType data [MaxSize];
int length;
} SeqList;
Void InitList (SeqList * L) {
L - & gt; Length=0;
}
The Status CreatList (SeqList * L, int n) {
If (n> MaxSize | | n<1) {
Printf (" input illegal \ n ");
return 0; }
Int temp.
for(int i=0; iscanf("%d",& Temp);
L - & gt; Data [I]=temp;
}
L - & gt; Length=n;
return 1;
}
Int the Empty (SeqList * L) {
If (L - & gt; Length==0)
return 1;
The else return 0;
}
Int Length (SeqList * L) {
The return of L - & gt; Length;
}
Int PrintList (SeqList * L) {
If (Empty (L)==1) return 0;
for(int i=0; iPrintf (" % d, L - & gt; Data [I]);
return 1;
}
Int Ret (SeqList * L, int I ElemType & amp; E) {
If (i<1 | | i> L - & gt; Length)
return 0;
E=L - & gt; Data [I - 1);
return 1;
}
Int the Insert (SeqList * L, int I, ElemType e)
{
Int j;
If (i<1 | | i> L - & gt; Length + 1)
return 0;
i--;
For (j=L - & gt; Length; J> i; J -)
L - & gt; Data [j]=L - & gt; Data [1];
L - & gt; Data [I]=e;
L - & gt; Length++;
return 1;
}
Int the Delete (SeqList * L, int I, ElemType & amp; E)
{
Int j;
If (i<1 | | i> L - & gt; Length)
return 0;
i--;
E=L - & gt; Data [I];
for(j=i; JL - & gt; Data [j]=L - & gt; Data [j + 1);
L - & gt; Length -;
return 1;
}
Have a great god help me to look at the program!!!!!!