# Include "iostream. h"
# Include "iomanip. h"
Typedef int ElemType;
Typedef struct ADTList
{
ElemType Elem;
Struct ADTList * next;
} ADTList;
////////////////////////////////////////
// Linked list function
Bool InitList (ADTList * & L );
Void DestroyList (ADTList * L );
Void ClearList (ADTList * L );
Bool ListEmpty (ADTList * L );
Long ListLength (ADTList * L );
Bool GetElem (ADTList * L, long index, ElemType & e );
Long LocateElem (ADTList * L, ElemType e );
Int compare (ElemType elem1, ElemType elem2 );
Bool PriorElem (ADTList * L, ElemType cur_e, ElemType & pre_e );
Bool NextElem (ADTList * L, ElemType cur_e, ElemType & next_e );
Bool ListInsert (ADTList * L, long index, ElemType e );
Bool ListDelete (ADTList * L, long index, ElemType & e );
Bool visit (ElemType elem );
Bool ListTraverse (ADTList * L );
///////////////////////////////////////
// Test functions
Bool create (ADTList * L );
Bool create1 (ADTList * L );
Bool deleteTest (ADTList * L );
///////////////////////////////////////
Int main (int argc, char ** argv)
{
ADTList * list;
List = NULL;
Cout <"linked list experiment program" <///////////////////////////////////////
Cout <"List Init:" <If (! InitList (list ))
Return 1;
///////////////////////////////////////
If (! Create (list ))
Return 1;
Cout < if(!ListTraverse(list))
return 1;
///////////////////////////////////////
cout<ClearList (list );
Cout < if(!ListTraverse(list))
return 1;
///////////////////////////////////////
if(!create1(list))
return 1;
cout<If (! ListTraverse (list ))
Return 1;
///////////////////////////////////////
DeleteTest (list );
///////////////////////////////////////
Return 0;
}
<