📄 city.h
字号:
#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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -