实用标准文案
PAGE
精彩文档
#include #include #include
#include
#define MaxSize 100 #define VISITED 1 #define NOTVISITED 0 #define Infinite 1073741823
#define MaxViewNum 50 /*景点个数最大50*/
#define MaxRoad 1000 /*定义路径为无穷大*/
#define N 16 /*目前景点个数*/
typedef struct
{
char name[30]; /*景点名称*/
char number[10]; /*景点代号*/
char introduce[200]; /*景点介绍*/
}Elemtype;
typedef struct
{
int num; /*景点编号*/
Elemtype date; /*景点信息*/
}View; /*定义景点*/
typedef struct
{
View view[MaxViewNum]; /*存放顶点的一维数组,数组第零单元没有用上*/
unsigned int length[MaxViewNum][MaxViewNum]; /*存放路径长度*/
int m,n;
}MGraph;
MGraph MGr; /*全局变量,定义MGr为MGraph类型*/
int shortest[MaxViewNum][MaxViewNum]; /*定义全局变量存贮最小路径*/
int path[MaxViewNum][MaxViewNum]; /*定义存贮路径*/
void init()
{
int i,j;
MGr.view[1].num=1;
strcpy(MGr.view[1].date.name,"学校正门");
strcpy(MGr.view[1].date.number,"001");
strcpy(MGr.view[1].date.introduce,"毗邻中心大道,交通便利。");
MGr.view[2].num=2;
strcpy(MGr.view[2].date.name,"行政楼");
strcpy(MGr.view[2].date.number,"002");
strcpy(MGr.view[2].date.introduce,"学校领导,办公主楼。");
MGr.view[3].num=3;
strcpy(MGr.view[3].date.name,"科技楼");
strcpy(MGr.view[3].date.number,"003");
strcpy(MGr.view[3].date.introduce,"逸夫科技楼");
MGr.view[4].num=4;
strcpy(MGr.view[4].date.name,"家属院");
strcpy(MGr.view[4].date.number,"004");
strcpy(MGr.view[4].date.introduce,"兰州理工大学,教职工家属院。");
MGr.view[5].num=5;
strcpy(MGr.view[5].date.name,"图书馆");
strcpy(MGr.view[5].date.number,"005");
strcpy(MGr.view[5].date.introduce,"历史悠久,文化积淀。供同学安静学习的环境。");
MGr.view[6].num=6;
strcpy(MGr.view[6].date.name,"机械基地");
strcpy(MGr.view[6].date.number,"006");
strcpy(MGr.view[6].date.introduce,"土木工程学院和机电工程学院,实习实践的地方。");
MGr.view[7].num=7;
strcpy(MGr.view[7].date.name,"学生公寓");
strcpy(M