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

📄 usedline.h

📁 航空订票系统 学校大作业开发的
💻 H
字号:
//UsedLine.h
//已安排航班的航线,包括售票情况
#include <string>
class UsedLineList
{
public:
    char destination[10];      //目的地
};
struct UsedFlight
{
    COleDateTime FlyTime;      //每天具体的起飞时间
	char PlaneType[6];         //飞机型号
	char PlaneNum[6];          //航班号
	int  FirCNum;              //头等舱位数
	int  TouCNum;              //经济舱位数
	double FirCP;              //头等舱票价
	double TouCP;              //经济舱票价
	int FirCFreeNum;           //头等舱剩余票数
	int TouCFreeNum;           //经济舱剩余票数
};
class UsedFlightQueue           //使用循环队列
{
public:
  int front;                   //第一个元素下标
  int rear;                    //最后一个元素下标
  UsedFlight flight[31];       //每条航线七天内最多的航班班数为30
  UsedFlightQueue()
	{rear=0;front=1;}
  bool enQueue(COleDateTime Time,int i,int j);   //进队列
  bool deQueue();  //出队列
  int  Find(COleDateTime Time);
  int insert(int beg,COleDateTime Time,int Lindex,int Findex);//插入新的航班
  void remove();
  int length()const
  {return ((rear+31)-front+1)%31;}
};

class UsedLine
{
public:
	int LineSz;                        //航线数
	UsedLineList lineArray[200];       //放航线的数组
	UsedFlightQueue flightArray[200];   //放航班的数组
    UsedLine()
	{
		LineSz=0;
	}
	void UsedLine::Create();  //初始化,更新航班
	void deleteLine(int index); //删除航线
	void addLine(int Lindex,int Findex);//增加航线并同时增加一个航班
	void addFlight(int Lindex,int Findex); //增加航班到已存在的航线
////////////////////////////////////////////////////////////////////////////////////////
	COleDateTime GetNextNDay(int n)   //返回的n天后的日期,基于当天日期
	{
	struct tm *NextDay; 
    time_t t; 
    t=time(NULL); 
	t+=(n*24*3600);
    NextDay=localtime(&t); 
	COleDateTime Next;
	Next.SetDateTime(NextDay->tm_year+1900,NextDay->tm_mon+1,NextDay->tm_mday,0,0,0);
	return Next;
	}
	/////////////////////////////
	int CompareDate(COleDateTime d1,COleDateTime d2)
	{
	d1.SetDateTime(d1.GetYear(),d1.GetMonth(),d1.GetDay(),0,0,0);
	d2.SetDateTime(d2.GetYear(),d2.GetMonth(),d2.GetDay(),0,0,0);
	if(d1>d2)return 1;
	 else if(d1<d2)return -1;
	   else return 0;
	}
};

⌨️ 快捷键说明

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