- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
C银行排队系统
#ifndef LIST_H#define LIST_H#includestdlib.htemplateclass Tclass List{struct Node//双向结点声明{T data;Node *prev,*next;Node(const T d=T(),Node *p=NULL,Node *n=NULL):data(d),prev(p),next(n){}};int size;//数据结点个数Node *head;//头结点指针Node *tail;//尾结点指针void init()//初始化函数{size=0;head=new Node;tail=new Node;head-next=tail;tail-prev=head;}public:class const_iterator{protected:Node *current;T retrieve()const{return(current-data);}const_iterator(Node *p):current(p){}friend class ListT;public:const_iterator():current(NULL){}const T operator*()const{return(retrieve());}//current-dataconst_iterator operator++()//前++{current=current-next;return(*this);}const_iterator operator++(int)//后++{const_iterator old=*this;//old=current;++(*this);//current=current-next;return(old);}const_iterator operator--()//前--{current=current-prev;return(*this);}const_iterator operator--(int)//后--{const_iterator old=*this;//old=current;--(*this);//current=current-next;return(old);}bool operator==(const const_iterator rhs)const{return(current==rhs.current);}bool operator!=(const const_iterator rhs)const{return(current!=rhs.current);}};class iterator:public const_iterator{protected:iterator(Node *p):const_iterator(p){}friend class ListT;public:iterator(){}T operator*(){return(retrieve());}const T operator*()const{return(const_iterator::operator*());}iterator operator++()//前++{current=current-next;return(*this);}iterator operator++(int)//后++{iterator old=*this;//old=current;++(*this);//current=current-next;return(old);}iterator operator--()//前--{current=current-prev;return(*this);}iterator operator--(int)//后--{iterator old=*this;//old=current;--(*this);//current=current-next;return(old);}};List(){init();}//默认构造函数List(const ListT l){init();operator=(l);}//复制构造函数~List(){clear();delete head;delete tail;}//析构函数const List operator=(const List l);//复制赋值运算符函数int Size()const{return(size);}//求数据个数bool Empty()const{return(size==0);}//判空函数void clear(){while(!Empty())Pop_front();}//清表iterator begin(){return(iterator(head-n
您可能关注的文档
最近下载
- 特种作业操作证 制冷与空调运行操作作业 实操培训.pdf VIP
- CL01实验室内审检查记录表.pdf VIP
- 幼儿园:实习心得.docx VIP
- (高清版)DB52∕T 895-2014 混凝土砌块用轻质配砖.pdf VIP
- BS EN 10025-6-2004第6部分:技术交付条件用于高屈服强度的扁平产品淬火和结构钢回火的条件.pdf VIP
- 2025法律职业伦理历年试题及答案.doc VIP
- 《房颤诊断和治疗中国指南(2023)》解读PPT课件.pptx VIP
- 40篇短文搞定高考英语3500单词(回顾巩固用).pdf VIP
- 大学生职业生涯规划.pdf VIP
- 2025 公司招聘简章(模板).pdf VIP
原创力文档


文档评论(0)