校园导航系统.docVIP

  • 3
  • 0
  • 约7.28千字
  • 约 8页
  • 2017-06-03 发布于湖北
  • 举报
#define INFINITY 10000 /*无穷大*/ #define MAX_VERTEX_NUM 40 #define MAX 40 #include stdlib.h #include stdio.h #include conio.h #include string.h typedef struct ArCell { int adj; //路径长度 }ArCell,AdjMatrix[MAX_VERTEX_NUM][MAX_VERTEX_NUM]; typedef struct //图中顶点表示主要景点,存放景点的编号、名称、简介等信息, { char name[30]; int num; char introduction[100];//简介 }infotype; typedef struct { infotype vexs[MAX_VERTEX_NUM]; AdjMatrix arcs; int vexnum,arcnum; }MGraph; MGraph b; void cmd(void); MGraph InitGraph(void); void Menu(void); void Browser(MGraph *G); void ShortestPath_DIJ(MGraph * G); void Floyd(MGraph *G); void Search(MGraph *G); int LocateVex(MGraph *G,char* v); MGraph * CreatUDN(MGraph *G); void print(MGraph *G); int main(void) { system(color 1f); system(mode con: cols=140 lines=130); cmd(); getchar(); return 0; } void cmd(void) { int i; b=InitGraph(); Menu(); scanf(%d,i); while(i!=5) { switch(i) { case 1:system(cls);Browser(b);Menu();break; case 2:system(cls);ShortestPath_DIJ(b);Menu();break; case 3:system(cls);Floyd(b);Menu();break; case 4:system(cls);Search(b);Menu();break; case 5:exit(1);break; default:break; } scanf(%d,i); } } MGraph InitGraph(void) { MGraph G; int i,j; G.vexnum=10; G.arcnum=14; for(i=0;i G.vexnum;i++) G.vexs[i].num=i; strcpy(G.vexs[0].name,综合食堂); strcpy(G.vexs[0].introduction,新建标准化食堂); strcpy(G.vexs[1].name,东西办公楼); strcpy(G.vexs[1].introduction,全体教师办公场所,楼高12层,各种设施齐全); strcpy(G.vexs[2].name,5号学生宿舍楼); strcpy(G.vexs[2].introduction,计算机系男生宿舍楼,苏式建筑); strcpy(G.vexs[3].name,医院); strcpy(G.vexs[3].introduction,校医院,设施不是很齐全,只能看小病,收费较贵); strcpy(G.vexs[4].name,图书馆); strcpy(G.vexs[4].introduction,藏书60万册,设施良好,2楼为电子阅览室,环境幽雅); strcpy(G.vexs[5].name,足球场); strcpy(G.vexs[5].introduction,现代化塑胶跑道,人造草坪,适宜锻炼身体的场所); strcpy(G.vexs[6].name,沁园); strcpy(G.vexs[6].introduction,绿树成荫,适宜休息和读书); strcpy(G.vexs[7].name,主教学楼); strcpy(G.vexs[7].introduction,学院最大的教学楼,共5层,环形

文档评论(0)

1亿VIP精品文档

相关文档