airportsimulation.h

来自「金元平版数据结构 实验答案 有关飞机场内容的实验」· C头文件 代码 · 共 60 行

H
60
字号
// airPortSimulation.h: interface for the airPortSimulation class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_AIRPORTSIMULATION_H__09465257_9ECF_42AF_8018_1BFEB3C8ADD1__INCLUDED_)
#define AFX_AIRPORTSIMULATION_H__09465257_9ECF_42AF_8018_1BFEB3C8ADD1__INCLUDED_

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

#include <cstdlib>
#include <ctime>
#include <cmath>
#include <iostream>
using namespace std;
#include "minPQ.h"

struct plane
{
	int id;
	int tm;	// arrive time
	int rt;	// remained gas which has been converted to flying time
};

enum action {ARRIVE, DEPART};
class airPortSimulation  
{
public:
	void runSimulation();
	airPortSimulation();
	virtual ~airPortSimulation();

private:
	void conclude();
	void idle();
	void fly(plane& p);
	bool land(plane& p);
	void refuse(plane& p, action kind);
	plane* newPlane(plane& p, action kind);
	int poissionRandom(double& expectValue);
	void randomize();
	minHeap<plane> landing;
	minHeap<plane> takeoff;
	double expectArrive;
	double expectDepart;
	int currentTime;
	int endTime;
	int idleTime;
	int landWait;
	int takeOffWait;
	int nLand;
	int nPlanes;
	int nRefuse;
	int nTakeOff;
	int nCrash;
};

#endif // !defined(AFX_AIRPORTSIMULATION_H__09465257_9ECF_42AF_8018_1BFEB3C8ADD1__INCLUDED_)

⌨️ 快捷键说明

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