- 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
您可能关注的文档
- 天津电大 法制史13年 行测(13 years' survey of legal history of Tianjin TV University).doc
- 天津限价房申请人具备的条件(Tianjin housing price limit applicants have the conditions).doc
- 天津(Tianjin).doc
- 天津违章摄录地点大全(Tianjin illegal video recording site).doc
- 天然药材---葛根(Pueraria lobata).doc
- 天然药物化学总论(Journal of natural medicinal chemistry).doc
- 天翼宽带光盘安装使用说明(Tianyi broadband CD-ROM installation instructions).doc
- 天能科技竞争优势(Day to day technology competitive edge).doc
- 天门市住房公积金管理实施细则(Detailed rules for the implementation of the Tianmen housing provident fund management).doc
- 太仓市2009~2010学年第一学期期终考试试卷 初三化学(Taicang City, 2009 ~ 2010 year first semester final exam of Junior Chemistry).doc
原创力文档

文档评论(0)