city.h

来自「该程序是作者编写的程序」· C头文件 代码 · 共 39 行

H
39
字号
#ifndef _H_CITY
#define _H_CITY

#define N 6
// N表示城市的最大数目
int num;    // 实际的城市数目
int nn;     // 城市间有效信息数目

typedef struct
{  // 定义城市的结构
	int id;            // 城市的唯一标志号
	char name[30];     // 城市名称
	float population;  // 城市人口,单位:万人
	float area;        // 城市面积,单位:平方公里
} city_info;

typedef struct
{
	int from;         // 起点城市序号
	int end;          // 终止城市序号
	float length;     // 城市间的里程
} city_city;

city_info city[N];     // 城市的基本信息
float cost[N][N];      // 城市间的代价矩阵
float link[N][N];      // 城市间的连通邻接矩阵

city_city citylen[(N-1)*N/2]; // 城市间互连里程,用于排序

typedef struct
{
	int from;         // 起点城市序号
	int end;          // 终止城市序号
	float cost ;     // 城市间的费用
} city_city_cost;

city_city_cost  citycost[(N-1)*N/2]; // 城市间互连费用,用于排序

#endif

⌨️ 快捷键说明

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