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

📄 plane.h

📁 这是本人完成的一个空战模拟的程序
💻 H
字号:
// Plane.h: interface for the Plane class.
//
//////////////////////////////////////////////////////////////////////
#include "math.h"
#if !defined(AFX_PLANE_H__3B3E0B2C_5B26_4832_BB5A_3DF1D70D34FB__INCLUDED_)
#define AFX_PLANE_H__3B3E0B2C_5B26_4832_BB5A_3DF1D70D34FB__INCLUDED_

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

#define AIRRATEDOWN 1
#define AIRRATEUP 3
#define TAKEOFFTIMEDOWN 1
#define TAKEOFFTIMEUP 5
#define PLANEQUANTITYDOWN 2
#define PLANEQUANTITYUP 8

typedef enum {landing,flying,bomb,reback}planestate;
typedef enum {waiting,shoot,success,unsuccess}misslestate;

typedef struct
{
	double x;
	double y;
	double z;
}point;

class Plane
{
	point CurrentPosition;
	planestate State;
	double AirRate;

	
public:
	Plane();
	virtual ~Plane();
	void SetPlane(const point *p,double rate,planestate state);
	point & GetPosition();
	void AirDisplay();
	void AirUpdate();
};

class AirDrome
{
protected:
	point AirDromePosition;
	
};

class AirMass:public AirDrome
{
	point FlyTrager;
	int AirQuantity;
	int FlyingQuantity;
public:
	void CreateAir();
};



class MissleBase
{
	point MissleBasePosition;
	int MissleQuantity;
	misslestate CurrentMissleState;
public:
	void CreateMissle();
};

class Missle
{
	point CurrentMisslePosition;
	double MissleRate;
	int LaunchTime;
public:
	void MissleUpdate();
	void SetCurrentMisslePosition();
	point GetCurrentMisslePosition();
	void MissleDisplay();
};

class Target
{
	point TargetPosition;
public:
	Target(point p);
	point GetTarget();
};

class Track
{
	double a;
	double b;
	double c;
public:
	point CalculatePosition(double rate,double time,point start);
	Track(point x,point y);
};

class Radar
{
	Plane* AirArray[20];
	int preptr;
	int postptr;
public:
	void RadarUpdate();
};

double distance(point p1,point p2)
{
	return sqrt((p2.x-p1.x)*(p2.x-p1.x)+(p2.y-p1.y)*(p2.y-p1.y)+(p2.z-p1.z)*(p2.z-p1.z));
}

double random(int down,int up,int seed)
{
	srand((unsigned)seed);
	return (double)(rand()*(up-down));
}

#endif // !defined(AFX_PLANE_H__3B3E0B2C_5B26_4832_BB5A_3DF1D70D34FB__INCLUDED_)

⌨️ 快捷键说明

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