⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 queue.h

📁 航空订票系统 学校大作业开发的
💻 H
字号:
// Queue.h: interface for the Queue class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_QUEUE_H__E2141A2A_FC86_455E_BE08_8B4F6EEEFB24__INCLUDED_)
#define AFX_QUEUE_H__E2141A2A_FC86_455E_BE08_8B4F6EEEFB24__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

struct QueueInFile  //用于存放在文件中
{
	int line;     //标记文件中存放的是哪个航线下的排队信息
	int size;     //整一条航线下的排队的客户数
	int FSize[5]; //各个航班下排队的客户数
};

struct Queuer            //排队客户信息
{
	bool isTry;          //有空闲票,但不满足排队者要求时,是否进行询问,需要询问为true
	char name[20];       //排队客户姓名
	char ID[20];         //排队客户身份证号
	int  FCNum;          //需要的头等舱票额
	int  TCNum;          //需要的经济舱票额
};
////////////////////////////////////////////////////////////
class QLink              //用链表来组织排队用户
{
public:
	Queuer queuer;
	QLink *next;
    QLink(QLink* p=NULL) {next=p;}
	QLink(const Queuer& item,QLink* p=NULL)
	{ queuer=item; next=p;}
};
///////////////////////////////////////////////////////////////
class QFlight
{
public:
	COleDateTime FlyTime;     //起飞时间
	int size;                 //每个航班里已排队的人
	QLink* start;             //每个航班的在链表中的起始指针,便于有人退票时进行检查
	QLink* end;               //结束指针,方便加入排队客户的信息
	QFlight()
	{start=end=NULL;size=0;}
};
/////////////////////////////////////////////////////////////
class BuildQLink
{
public:
   int Size;             //一天之内一个航线内在 已排队的客户数
   QFlight qFlight[5];    //一天之内一个航线内的航班
   QLink* head;
   QLink* tail;
   BuildQLink(){
	      tail=head=new QLink;
		  Size=0;
		}
   ~BuildQLink(){
		QLink* temp;
		while(head!=NULL){
        temp=head;
		head=head->next;
		delete temp;
		}
	}
   //加入新的排队客户
   void insert(COleDateTime time,CString name,CString id,int FcNum,int TcNum,bool Try);
   QLink* Append(const Queuer &item); //读文件时加入元素
   int Find(COleDateTime time);//退票后,处理候票队伍时,查找航班
   void remove(QLink* item,int index);   //退票后,处理候票队伍时,删除已出列的客户
   void addFlight(int index,COleDateTime time); //新增航班时,对应的排队队列应调整
};
/////////////////////////////////////////////////////////////
//一天内,按航线分开,每条航线用链表存放所以当天内乘坐该航线飞机的排队客户
struct QueueData             
{
  bool isChange;            //若该天的纪录没有改变,即其值为false
  COleDateTime Date;        //存放该天的日期
  BuildQLink LineLink[200];
};
class Queue  
{
public:
    QueueData queueData[7];  //星期天到星期六(0-6)一一对应,即一天对应一个文件夹
	void readFile(int dayInWeek);
	void OnCreate();
	void Save();
	void deleteLine(int index);
	void addLine(int Lindex,int Findex,COleDateTime time);//新增航班时可能导致航班的增加,对应的排队队列应调整
	void addFlight(int Lindex,int Findex,COleDateTime time);//新增航班时,对应的排队队列应调整
};

#endif // !defined(AFX_QUEUE_H__E2141A2A_FC86_455E_BE08_8B4F6EEEFB24__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -