欢迎来到天天文库
浏览记录
ID:55411690
大小:32.00 KB
页数:8页
时间:2020-05-12
《校园导游咨询源代码.doc》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、#defineINFINITY10000/*无穷大*/#defineMAX_VERTEX_NUM40#defineMAX40#include#include#include#includetypedefstructArCell{intadj;//路径长度}ArCell,AdjMatrix[MAX_VERTEX_NUM][MAX_VERTEX_NUM];typedefstruct//图中顶点表示主要景点,存放景点的编号、名称、简介等
2、信息,{charname[30];intnum;charintroduction[200];//简介}infotype;typedefstruct{infotypevexs[MAX_VERTEX_NUM];//景点AdjMatrixarcs;//路径数组intvexnum,arcnum;//景点数,路径长度记录}MGraph;MGraphb;//全局变量voidcmd(void);//在主函数中用来调用其他应用子函数的函数声明MGraphInitGraph(void);//用来构造学校地图的子函数返回MG
3、raph类型voidMenu(void);//菜单函数;voidBrowser(MGraph*G);//调用MGraph类型的地址,进行voidShortestPath_DIJ(MGraph*G);//迪杰斯特拉算法求最短路径的子函数voidFloyd(MGraph*G);//佛洛伊德算法voidSearch(MGraph*G);//寻找要查询的景点,并输出该景点的信息intLocateVex(MGraph*G,char*v);//定点位置MGraph*CreatUDN(MGraph*G);////初始化
4、图形,接受用户输入voidprint(MGraph*G);//打印输出子函数/******************************************************/voidmain(void){system("color1f");//设置调试窗口背景和字体颜色system("modecon:cols=140lines=130");//设置调试窗口的大小cmd();//用该函数来调用其他需要用到的函数}/****************************************
5、**************/voidcmd(void)//用来调用其他需要用到的函数的子函数{inti;b=InitGraph();//构造校园地图Menu();//调用菜单函数scanf("%d",&i);while(i!=5){switch(i){case1:system("cls");Browser(&b);Menu();break;case2:system("cls");ShortestPath_DIJ(&b);Menu();break;case3:system("cls");Floyd(&b)
6、;Menu();break;case4:system("cls");Search(&b);Menu();break;case5:exit(1);break;default:break;}scanf("%d",&i);}}//************************************************************************MGraphInitGraph(void)//构造校园地图{MGraphG;inti,j;G.vexnum=10;//景点数量G.arcnum
7、=14;//路径数量for(i=0;i8、。");strcpy(G.vexs[2].name,"教学楼");strcpy(G.vexs[2].introduction,"全校学生公共教学楼,是学生获取知识的源泉");strcpy(G.vexs[3].name,"学生食堂");strcpy(G.vexs[3].introduction,"里面有各种美食,就餐环境幽雅");strcpy(G.vexs[4].name,"南村公寓");strcpy(G.vexs[4].int
8、。");strcpy(G.vexs[2].name,"教学楼");strcpy(G.vexs[2].introduction,"全校学生公共教学楼,是学生获取知识的源泉");strcpy(G.vexs[3].name,"学生食堂");strcpy(G.vexs[3].introduction,"里面有各种美食,就餐环境幽雅");strcpy(G.vexs[4].name,"南村公寓");strcpy(G.vexs[4].int
此文档下载收益归作者所有