List.h
资源名称:C++100.rar [点击查看]
上传用户:wszmarenbt
上传日期:2013-04-26
资源大小:2552k
文件大小:1k
源码类别:
Windows编程
开发平台:
Visual C++
- //THIS HEAD FILE ONLY DEFINES A "SINGLE DIRECTION LIST" CLASS
- //FILE LIST.H
- #include <stdio.h>
- class NODE
- {
- //FRIEND CLASS "LIST" CAN HAVE ACCESS TO THE CLASS "NODE" 'S PRIVATE PART
- friend class LIST;
- private :
- //NEXT NODE LINK
- NODE *NEXT;
- //THE CURRENT NODE DATA
- int DATA;
- };
- class LIST
- {
- private :
- //THE HEAD OF THE LIST
- NODE *HEAD;
- public :
- //CONSTRUCTOR FUNCTION
- LIST()
- {
- //INITIAL
- HEAD=0;
- }
- //ADD TO THE FRONT OF THE LIST
- void Build_Forward(int Data);
- //ADD TO THE BACK OF THE LIST
- void Build_Backward(int Data);
- //GET THE HEAD OF THE LIST
- NODE* GET_HEAD();
- //GET THE DATA OF THE LIST
- int LIST::GET_NEXT(NODE * &TEMP);
- //GET THE DATA IN THE GIVED POSITION
- int LIST::GET_POSITION(int P);
- //REMOVE ALL THE NODES IN THE LIST
- void CLEAR();
- ~LIST()
- {
- CLEAR();
- }
- };