#include
#include
# define MAXSIZE 50
Typedef char ElemType;
Typedef struct//defined sequence table
{
ElemType data [MAXSIZE];
int length;
}SqList;
Void CreateList (SqList * & amp; L, ElemType a [], int n)//build order table
{
int i;
L=(SqList *) malloc (sizeof (SqList));
For (I=0; I & lt; n; I++)
L - & gt; Data=[I] a [I];
L - & gt; Length=n;
}
Void InitList (SqList * & amp; L)//dynamic allocation of storage
{
L=(SqList *) malloc (sizeof (SqList));
L - & gt; Length=0;
}
Void DestroyList (SqList * L)//release space space of the linear table L
{
Free (L);
}
Bool ListEmpty (SqList * L)//to determine whether a linear list is empty table
{
Return (L - & gt; Length==0);
}
Int ListLenth (SqList * L)//the length of the linear table
{
Return (L - & gt; Length);
}
Void DispList (SqList * L)//output linear table
{
int i;
If (ListEmpty (L))
return;
For (I=0; I & lt; L - & gt; Length; I++)
Printf (" % c ", L - & gt; Data [I]);
printf("\n");
}
Bool GetElem (SqList * L, int I ElemType & amp; E)//in linear table L specify the location of a data element in the
{
If (i<1 | | i> L - & gt; Length)
return false;
E=L - & gt; Data [I - 1);
return true;
}
Int LocateElem (SqList * L, ElemType & amp; E)//locating LocateElem (L, e)
{
Int I=0;
While (I & lt; L - & gt; Length & amp; & L - & gt; Data [I]!=e)
i++;
If (I & gt; L - & gt; Length)
return 0;
The else
Return the I + 1;
}
Bool ListInsert (SqList * & amp; L, int I ElemType e)//insert a data element
{
int j;
If (i<1 | | i> L - & gt; Length + 1)
return false;//parameter errors are returns false
i--;//serial number sequence table logic into a physical symbol
For (j=L - & gt; Length; J & gt; i; J -)//the data [I.. n] element back a place
L - & gt; Data [j]=L - & gt; Data [1];
L - & gt; Data [j]=e;//insert element e
L - & gt; length++;//order table length increase 1
return true;//insert return true success
}
Bool ListDelete (SqList * & amp; L, int I ElemType & amp; E)//delete data element
{
int j;
If (i<1 | | i> L - & gt; Length)//parameter error returns false
return false;
i--;//serial number sequence table logic into physical serial number
E=L - & gt; Data [I];
For (j=I; J & lt; L - & gt; Length - 1. J++)//the data [I.. n - 1) element forward
L - & gt; Data [j]=L - & gt; Data [j + 1);
L - & gt; Length -;//order table length reduced by 1
return true;//deleted successfully returns true
}
CodePudding user response:
Supplement: using the compiler VS 2017CodePudding user response:
And this error: error LNK2019: cannot resolve external _main symbols, the symbol in the function "int __cdecl invoke_main (void)" (? Invoke_main @ @ YAHXZ) referenced