校园导游系统程序.docx
《校园导游系统程序.docx》由会员分享,可在线阅读,更多相关《校园导游系统程序.docx(20页珍藏版)》请在三一办公上搜索。
1、校园导游系统程序课题五:校园导游程序 1)问题描述 用无向网表示你所在学校的校园景点平面图,图中顶点表示主要景点,存放景点的编号、名称、简介等信息,图中的边表示景点间的道路,存放路径长度等信息。要求能够回答有关景点介绍、游览路径等问题。 2)基本要求 查询各景点的相关信息; 查询图中任意两个景点间的最短路径。 能够将图的信息保存到文件中,并指定文件打开。 增加、删除、更新有关景点和道路的信息。 附加难度:有余力的同学可以考虑用图形界面实现寻址的过程 3) 设计思想 核心数据结构定义一个图,将图保存后,对图进行面向指定节点到各个节点的最短路径的操作。可以再文件中保存多个导游图,例如保存学校图、芜
2、湖市图等文件。开始时选择文件,将指定文件中的信息导入到内存的图中。 #define Infinity 1000 #define MaxVertexNum 35 #define MAX 40 #include #include #include #include #include #include typedef struct arcell /边的权值信息 int adj; /权值 arcell,adjmatrixMaxVertexNumMaxVertexNum; /图的邻接矩阵类型 typedef struct vexsinfo /顶点信息 int position; /景点的编号 char
3、name32; /景点的名称 char introduction256; /景点的介绍 vexsinfo; typedef struct mgraph /图结构信息 vexsinfo vexsMaxVertexNum; /顶点向量(数组) adjmatrix arcs; /邻接矩阵 int vexnum,arcnum; /分别指定顶点数和边数 mgraph; /全局变量 int visited35; /用于标志是否已经访问过 int d35; /用于存放权值或存储路径顶点编号 mgraph campus; /图变量(大学校园) / (1) 对图初始化 mgraph initgraph int
4、i=0,j=0; mgraph c; c.vexnum =28; /顶点个数 c.arcnum =39; /边的个数 for(i=0;ic.vexnum ;i+) /依次设置顶点编号 c.vexsi.position =i; /依次输入顶点信息 strcpy(c.vexs0.name ,正门: ); strcpy(c.vexs0.introduction ,学校大门,离公交站很近|rn); strcpy(c.vexs1.name ,学校后门门: ); strcpy(c.vexs1.introduction ,去往新区、学校班车进出口); strcpy(c.vexs2.name ,人文学院: )
5、; strcpy(c.vexs2.introduction ,人文学院办公楼的住处,楼高3层); strcpy(c.vexs3.name ,管理学院: ); strcpy(c.vexs3.introduction ,MBA培训中心,楼高7层); strcpy(c.vexs4.name ,行政楼: ); strcpy(c.vexs4.introduction ,行政办公大楼,楼高5层); strcpy(c.vexs5.name,建设银行: ); strcpy(c.vexs5.introduction ,学生取款处,楼高1层); strcpy(c.vexs6.name ,体育馆: ); strcp
6、y(c.vexs6.introduction ,室内各类球类运动); strcpy(c.vexs7.name,外语学院: ); strcpy(c.vexs7.introduction ,各种外语教学,楼高6层); strcpy(c.vexs8.name ,双馨园食堂: ); strcpy(c.vexs8.introduction ,学生就餐地点); strcpy(c.vexs9.name, 博学楼: ); strcpy(c.vexs9.introduction , 计算机科学与技术学院大楼,楼高13层); strcpy(c.vexs10.name ,学生宿舍: ); strcpy(c.vexs
7、10.introduction ,若干栋,离中山园食堂近); strcpy(c.vexs11.name ,中山园食堂: ); strcpy(c.vexs11.introduction ,学生就餐处); strcpy(c.vexs12.name ,图书馆: ); strcpy(c.vexs12.introduction ,历史悠久,文化气氛好); strcpy(c.vexs13.name ,法学楼: ); strcpy(c.vexs13.introduction ,研修法学佳地); strcpy(c.vexs14.name ,贵大学生超市: ); strcpy(c.vexs14.introduc
8、tion ,买各种日用品的地方); strcpy(c.vexs15.name ,大礼堂: ); strcpy(c.vexs15.introduction ,文艺演出所在地); strcpy(c.vexs16.name ,慎思楼: ); strcpy(c.vexs16.introduction ,自习的好地方); strcpy(c.vexs17.name ,逸夫楼: ); strcpy(c.vexs17.introduction ,经济学院办公楼); strcpy(c.vexs18.name ,文化书院: ); strcpy(c.vexs18.introduction ,推动东西方文化交流的重要
9、桥梁); strcpy(c.vexs19.name ,派出所: ); strcpy(c.vexs19.introduction ,保卫学校安全); strcpy(c.vexs20.name ,贵州大学出版社: ); strcpy(c.vexs20.introduction ,发行各种图书); strcpy(c.vexs21.name ,贵州大学网球场: ); strcpy(c.vexs21.introduction ,打网球的地方); strcpy(c.vexs22.name ,化工学院: ); strcpy(c.vexs22.introduction ,各种实验的研究之地); strcpy(
10、c.vexs23.name ,贵州大学高等教育研究所: ); strcpy(c.vexs23.introduction ,关于高等教育的各种研究); strcpy(c.vexs24.name ,花溪海洋学校: ); strcpy(c.vexs24.introduction ,贵大内部学校); strcpy(c.vexs25.name ,贵州大学党校: ); strcpy(c.vexs25.introduction ,党员学习的地方); strcpy(c.vexs26.name ,校医院: ); strcpy(c.vexs26.introduction ,看小病的地方); strcpy(c.ve
11、xs27.name ,体育场: ); strcpy(c.vexs27.introduction ,田径远动地点); /依次输入边上的权值信息 for(i=0;ic.vexnum ;i+) for(j=0;jc.vexnum ;j+) c.arcs ij.adj =Infinity; /先初始化图的邻接矩阵 /部分弧长 c.arcs02.adj=50; c.arcs03.adj=60; c.arcs14.adj=90; c.arcs23.adj=60; c.arcs28.adj=40; c.arcs34.adj=60; c.arcs45.adj=70; c.arcs417.adj=200; c.
12、arcs57.adj=70; c.arcs69.adj=40; c.arcs718.adj=190; c.arcs811.adj=50; c.arcs912.adj=40; c.arcs1018.adj=70; c.arcs1112.adj=60; c.arcs1216.adj=50; c.arcs1314.adj=40; c.arcs1415.adj=50; c.arcs1516.adj=60; c.arcs1617.adj=60; c.arcs1718.adj=80; c.arcs1819.adj=60; c.arcs2021.adj=60; c.arcs36.adj=40; c.arcs
13、49.adj=70; c.arcs410.adj=80; c.arcs1114.adj=50; c.arcs1115.adj=50; c.arcs1322.adj=60; c.arcs1420.adj=90; c.arcs1521.adj=40; c.arcs2024.adj=80; c.arcs2223.adj=60; c.arcs2225.adj=80; c.arcs2324.adj=60; c.arcs2426.adj=100; c.arcs2427.adj=100; c.arcs2526.adj=90; c.arcs2627.adj=90; for(i=0;ic.vexnum ;i+)
14、 for(j=0;jc.vexnum ;j+) c.arcsji.adj =c.arcsij.adj ; FILE * pFile; pFile = fopen (myfile.txt,w); fwrite(c.vexs0.name,2,3,pFile); fwrite(c.vexs0.introduction,2,11,pFile); fwrite(rn,2,1,pFile); fwrite(c.vexs1.name,2,6,pFile); fwrite(c.vexs1.introduction,2,12,pFile); fwrite(rn,2,1,pFile); fwrite(c.vexs
15、2.name,2,5,pFile); fwrite(c.vexs2.introduction,2,15,pFile); fwrite(rn,2,1,pFile); fwrite(c.vexs3.name,2,5,pFile); fwrite(c.vexs3.introduction,2,10,pFile); fwrite(rn,2,1,pFile); fwrite(c.vexs4.name,2,4,pFile); fwrite(c.vexs4.introduction,2,11,pFile); fwrite(rn,2,1,pFile); fwrite(c.vexs5.name,2,5,pFil
16、e); fwrite(c.vexs5.introduction,2,10,pFile); fwrite(rn,2,1,pFile); /邻接矩阵是对称矩阵,对称赋值 fwrite(c.vexs6.name,2,4,pFile); fwrite(c.vexs6.introduction,2,8,pFile); fwrite(rn,2,1,pFile); fwrite(c.vexs7.name,2,5,pFile); fwrite(c.vexs7.introduction,2,11,pFile); fwrite(rn,2,1,pFile); fwrite(c.vexs8.name,2,6,pFil
17、e); fwrite(c.vexs8.introduction,2,6,pFile); fwrite(rn,2,1,pFile); fwrite(c.vexs9.name,2,4,pFile); fwrite(c.vexs9.introduction,2,17,pFile); fwrite(rn,2,1,pFile); fwrite(c.vexs10.name,2,5,pFile); fwrite(c.vexs10.introduction,2,11,pFile); fwrite(rn,2,1,pFile); fwrite(c.vexs11.name,2,6,pFile); fwrite(c.
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 校园 导游 系统 程序
链接地址:https://www.31ppt.com/p-3595314.html