数据结构课程设计--校园导航系统(5)

2019-03-29 18:08

case 'z': system(\); printf(\┏━━━━━━━━━━━━━━━━━━━━┓\\n\); printf(\┃ 感谢使用 ┃\\n\); printf(\┃ 辽宁工程技术大学 ┃\\n\); printf(\┃ 智能导航系统 ┃\\n\); printf(\┗━━━━━━━━━━━━━━━━━━━━┛\\n\); exit(0); default: printf(\输入信息错误!\\n请输入x或y或z.\\n\); break;} } } /* 迪杰斯特拉算法来计算出起点到各个顶点之间的最短路径,v0为起点 */ void ShortestPath_DIJ(MGraph * G) { int v,w,i,min,t=0,x,flag=1,v0,v1,have[100],k; int final[20], D[20], p[23][23]; while(flag) { printf(\请输入起始景点编号:\\n\); scanf(\,&v0); if(v0<0||v0>G->vexnum) printf(\景点编号不存在!\); printf(\请输入终止景点编号:\\n\); scanf(\,&v1); if(v1<0||v1>G->vexnum) printf(\景点编号不存在!\); if(v0>=0&&v0vexnum&&v1>=0&&v1vexnum) flag=0; } for(v=0;vvexnum;++v) { final[v]=0; D[v]=G->arcs[v0][v].adj; for(w=0;wvexnum;++w) p[v][w]=INFINITY; if(D[v]

p[v][v0]=1; p[v][v]=1; } } D[v0]=0; final[v0]=1; have[0]=v0; for(i=1;ivexnum;++i) { min=INFINITY; for(w=0;wvexnum;++w) if(!final[w]) if(D[w]vexnum;++w) if(!final[w]&&((min+(G->arcs[v][w].adj))arcs[v][w].adj; for(x=0;xvexnum;x++) p[w][x]=p[v][x]; p[w][w]=1; } } for(i=0;ivexnum;i++) { if(p[v1][have[i]]==1){ printf(\,G->vexs[have[i]].name);} } if((v1-v0)==1)printf(\路径长度:%d\\n\,G->arcs[v0][v1]); else printf(\路径长度:%d\\n\,D[v1]); }//ShortestPath_DIJ end /*查找函数的建立 */ void Search(MGraph *G) { int k,flag=1; while(flag) 21

{ printf(\请输入要查询的景点编号:\); scanf(\,&k); if(k<0||k>G->vexnum) { printf(\景点编号不存在!请重新输入景点编号:\); scanf(\,&k); } if(k>=0&&kvexnum) flag=0; } printf(\┏━━┳━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\\n\); printf(\┃编号┃景点名称 ┃简介 ┃\\n\); printf(\┃%-4d┃%-16s┃%-58s┃\\n\,G->vexs[k].num,G->vexs[k].name,G->vexs[k].introduction); printf(\┗━━┻━━━━━━━━┻━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛\\n\); }//Search end void show1() { printf(\★★ 欢迎使用辽宁工程技术大学智能导航系统 ★★\\n\); printf(\辽宁工程技术大学葫芦岛校区平面图\\n\\n\); printf(\学校北门\\n\); printf(\┃ \\n\); printf(\┏━━行政楼━━━━━━━━━静远楼\\n\); printf(\┃ ┃\\n\); printf(\┃ 耘慧楼\\n\); printf(\┃ ┃\\n\); printf(\┃ ┃\\n\); printf(\体育场 尔雅楼\\n\); printf(\┃ ┃\\n\); printf(\二食堂 ┃\\n\); printf(\┃ ┃\\n\); printf(\楼 ┃\\n\); printf(\楼━┃ ┃\\n\); printf(\楼 ┃\\n\); printf(\┃ ┃\\n\); printf(\小体育场,篮球场━━综合楼━━━━━━━小拱桥\\n\); printf(\┃ ┃ ┃\\n\); printf(\┃ 一食堂 ┃\\n\); printf(\浴池 ━━━━B楼━━A楼━━━━━━ \\n\); 22

} void list() { printf(\学校景点列表:\\n\); printf(\学校南门 \); printf(\静远楼 \); printf(\耘慧楼 \); printf(\尔雅楼 \); printf(\小拱桥\\n\); printf(\楼 \); printf(\楼 \); printf(\一食堂 \); printf(\综合楼 \\n\); printf(\行政楼 \); printf(\体育场 \); printf(\二食堂 \); printf(\楼 \); printf(\楼\\n\); printf(\楼 \); printf(\浴池 \); printf(\篮球场、足球场\\n\\n\); } /*目录函数的构建*/ void Menu() { printf(\辽宁工程技术大学葫芦岛校区导游图\\n\); printf(\┏━━━━━━━━━━━━━━━━━━━━┓\\n\); printf(\┃ x.选择出发点和目的地 ┃\\n\); printf(\┃ y.查看景点信息 ┃\\n\); printf(\┃ z.退出系统 ┃\\n\); printf(\┗━━━━━━━━━━━━━━━━━━━━┛\\n\); printf(\请选择服务\); } /*MGraph函数(图的构建)*/ MGraph InitGraph(void) { MGraph G; int i,j; G.vexnum=17; //顶点是17个 G.arcnum=25; //弧线有25个 for(i=0;i

strcpy(G.vexs[1].name,\静远楼\); strcpy(G.vexs[1].introduction,\电控、电信学院用楼,设有图书馆、阅览室等。\); 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].introduction,\连接生活区和教学区的桥。\); 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,\食堂,可用饭卡吃饭\); strcpy(G.vexs[8].name,\综合楼\); strcpy(G.vexs[8].introduction,\校区内的百货大楼\); strcpy(G.vexs[9].name,\行政楼\); strcpy(G.vexs[9].introduction,\学校行政办公场所,校区最高的建筑\); strcpy(G.vexs[10].name,\体育场\); strcpy(G.vexs[10].introduction,\运动会举办地\); strcpy(G.vexs[11].name,\二食堂\); strcpy(G.vexs[11].introduction,\校区最实惠的食堂,内有回民餐厅\); strcpy(G.vexs[12].name,\楼\); strcpy(G.vexs[12].introduction,\男生宿舍\); strcpy(G.vexs[13].name,\楼\); strcpy(G.vexs[13].introduction,\男生宿舍\); strcpy(G.vexs[14].name,\楼\); strcpy(G.vexs[14].introduction,\女生宿舍\); strcpy(G.vexs[15].name,\浴池\); strcpy(G.vexs[15].introduction,\学生洗澡的地方\); strcpy(G.vexs[16].name,\篮球场、足球场\); strcpy(G.vexs[16].introduction,\比赛以及学生运动的地方\); for(i=0;i


数据结构课程设计--校园导航系统(5).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:教育学第四章教育与人的发展(附答案)

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: