实验二-2(Experiment two, -2).docVIP

  • 4
  • 0
  • 约7.25千字
  • 约 21页
  • 2017-10-06 发布于河南
  • 举报
实验二-2(Experiment two, -2)

实验二-2(Experiment two, -2) Header folder linklist2.h / / definition of student records Struct student{ Char name[10]; / / name Short grade; / / fraction }; / / ElemType was defined as student type Typedef student ElemType; / / type single list node Struct LNode{ ElemType data; / / range LNode* next; / / pointer domain }; / / initialize a single list Void InitList (LNode* HL); / / empty list Void ClearList (LNode* HL); / / for the length of a single linked list Int ListSize (LNode* HL); Check / single linked list is empty Bool ListEmpty (LNode* HL); Returns the specified number of nodes / value in a single list ElemType GetElem (LNode*, HL, int, POS); / / traverse a single table Void TraverseList (LNode* HL); / / from a single list to find elements Bool FindList (LNode*, HL, ElemType, item); / / update a single list in a given element Bool UpdateList (LNode*, HL, const, ElemType, item); / / table insert elements to a single Void InsertList (LNode*, HL, const, ElemType, item, int, mark); / / delete elements from a single list Bool DeleteList (LNode*, HL, ElemType, item, int, mark); In order to output a single list / / Void OrderOutputList (LNode*, HL, int, mark); / / compare two elements are equal Bool poerator== (const, ElemType, R1, const, ElemType, R2); Two / / the size of the elements Bool poerator (const, ElemType, R1, const, ElemType, R2); Output / / an element Ostream operator (ostream, Ostr, const, ElemType, R); / / an element input Istream operator (istream, istr, ElemType, R); Implementing file linklist2.cpp #includeiomanip.h #includestdlib.h #includestring.h #include linklist2.h / / initialize a single list Void InitList (LNode* HL) { HL=NULL; } / / empty list Void ClearList (LNode* HL) { LNode, *cp, *np; Cp=HL; While (CP, =NULL) { Np=cp-next; Delete cp; Cp=np; } HL=NULL; } / / for the length of a single linked list Int ListSize (LNode* HL) { LNode* p=HL; Int i=0; While (P, =NULL) { I++; P=p-next; } Return i; } Check / single linked list is empty Bool ListEm

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档