📄 head.h
字号:
/*=================head.h=====================*/
/*=============头文件,宏定义,函数申明========*/
#include"stdio.h"
#include"stdlib.h"
#include"math.h"
#include"conio.h"
#include"time.h"
#include"graphics.h"
#define upkey 72 /*------上方向键-------*/
#define downkey 80 /*------下方向键-------*/
#define leftkey 75 /*------左方向键-------*/
#define rightkey 77 /*------右方向键-------*/
#define Enter 13 /*------回车键---------*/
#define ESC 27 /*------ESC键----------*/
#define DisplayColor BLACK /*------演示界面背景色-*/
#define StarColor WHITE /*------星空颜色-------*/
#define LockColor RED /*------锁定颜色-------*/
#define mMax 10 /*------最大目标数-----*/
#define nMax 10 /*------最多指标数-----*/
int n=6,m=3; /*目标数初始定为六个,目标指标定为3个*/
/*------演示矩形框结构----*/
struct RECT{
int left,top,right,bottom;
int width,height,d;
}rect;
/*------炮台结构--------*/
struct Emplacement{
int x,y;
int width,lenth;
int color;
}emp;
/*---------------------坦克目标属性---------------------------*/
struct Target{
int ID; /*---坦克标识符,用以识别该目标的唯一编号----*/
int x,y; /*---坦克坐标----*/
int r,color; /*---坦克半径和颜色--*/
float d; /*---距离----*/
int dIndex; /*---距离索引----*/
float T; /*---贴近度----*/
int TIndex; /*---贴近度索引----*/
int pIndex; /*---坦克排序索引---*/
int direction; /*---坦克当前运动方向---*/
float inva,distance,power;
/*----分别为坦克的三个指标:“侵略性”、“距炮台距离”、“攻击力”---*/
}Tank[nMax]; /*---定义坦克目标数组---*/
int color[3]={WHITE,YELLOW,RED}; /*---定义坦克的三种颜色值---*/
/*---------------------动画演示-------------------------------*/
void InitDisplay(); /*图形初始化*/
void Display(); /*动画演示:找出当前最优目标并击毁*/
void Emplacement(); /*画炮台*/
void DisplayBG(); /*演示背景*/
void ShowInt(int data,int x,int y); /*将整型转化为字符型并显示/
void DrawMissile(int x,int y,int r,int color); /*画导弹*/
void DrawTank(struct Target T_pro,int Tcolor,int color); /*画坦克*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -