?? queue.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 + -