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

📄 airportsimulation.h

📁 一个模拟机场控制飞机起飞降落及查询功能的程序。
💻 H
字号:
#include "Queue.h"

struct plane
{
	int id;                        //编号
	int tm;                        //到达队列时间
	int fuel;                      //飞机所剩燃油,是个虚值,是指该飞机折合成时间为0时的燃油。
	                               //而该飞机当时的燃油数为(fuel - curtime)
};
enum action { ARRIVE, DEPART};

class AirportSimulation
{
public:
	AirportSimulation();           //构造函数
	void RunSimulation();          //模拟运行
private:
	MinHeap<plane> landing;
	MinHeap<plane> takeoff;
	double expectarrive;
	double expectdepart;
	int curtime;                   //当前时间
	int endtime;                   //模拟时间单元数
	int idletime;                  //跑道空闲时间单元数
	int landwait;                  //降落飞机的总等待时间
	int nland;                     //降落的飞机数
	int nplanes;                   //处理的飞机数
	int nrefuse;                   //拒绝服务的飞机数
	int ntakeoff;                  //起飞的飞机数
	int takeoffwait;
	int nprang;                    //坠毁的飞机数
	void Randomize();              //设置随机数种子
	int PoissionRandom(double& expectvalue);        //泊松分布
	plane* NewPlane(plane &p, action kind);         //建立新飞机
	void Refuse(plane& p, action kind);             //拒绝服务
	void Land(plane& p);
	void Destory(plane& p);                 //处理坠毁飞机
	void Fly(plane& p);
	void Idle();                    //处理空闲时间
	void Conclude();                //总结
};

⌨️ 快捷键说明

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