校园导航系统数据结构课程设计
课程设计报告书
课程名称 数据结构 设计题目 校园导航系统 专业班级 计算机11-4 班 学 号 1101050110 姓 名 刘冬冬 指导教师 彭延军
2013 年 12 月
目录
1.设计时间……………………………………………… 2 2.设计目的……………………………………………… 2 3.设计任务……………………………………………… 2 4.设计内容……………………………………………… 2
4.1需求分析………………………………………………… 2 4.2总体设计………………………………………………… 3 4.3详细设计………………………………………………… 4 4.4测试与分析………………………………………………12
4.4.1测试…………………………………………………………12 4.4.2分析…………………………………………………………13
4.5 附录………………………………………………………14
5 总结与展望…………………………………………… 20 6.参考文献……………………………………………… 21 7.成绩评定……………………………………………… 21
1 设计时间 2013 年 12 月 3 日 2 设计目的1.加深对《数据结构》这一课程所学内容的进一步理解与巩固 2.通过完成课程设计,逐渐培养自己的编程能力; 3.培养给出题目后,构建框架,用计算机解决的能力; 4.通过调试程序积累调试 C 程序设计的经验;
3 设计任务给出校园各主要建筑的名称信息及有线路联通的建筑之间的距离,利用校园导航系统计算出 给定的起点到终点之间的最近距离及线路。
4 设计内容4.1 需求分析1.程序所能达到的功能: (1) map——输出山东科技大学平面图。 (2) init()——按相应编号输入各个节点内容,对相应路径赋值的函数。 (3) floyd()-- --弗洛伊德求最短路径 (4) information()——输出简介的函数 (5) Path()——最短路径的输出函数 (6) shortestpath()——调用弗洛伊德和最短路径输出的函数 (7) main()——主函数 2.输入的形式和输入值的范围: 输入数字和字母: 字母:以 s 查询最短路径;以 i 查询信息;以 e 退出程序。 数字:从 1 到 9 输入。 3.输出的形式: 从 A 到 B 得最短路径为: A-到-C-到-D-到-B 最短距离为:xxx 米。2
4.测试数据包括在正确的输入及输出结果及含有错误的输入及输出结果: Input:s Output:Please enter the number two to query : 1 7 Output:The shortest path from Area C dormitory building to library is: Area C dormitory building--Area C restaurant--library; The shortest distance is:150meters. Input:i Output:Please enter the number of query site: 3 Output:@name: Area B dormitory building @introduction:Area B student rest area input:e output:Thank y
ou for you use
4.2 总体设计1.抽象数据类型定义 typedef struct { char name[100] ; int number; char introduce[100]; }Vertex; 2.主程序模块的整体流程 1、进入主函数,调用 init(),map()。 2、选择“s” ,调用 shortestpath 函数,并同时调用 floyd 和 way 函数。 3、选择“i”,调用 information 函数 4、选择“e”,退出。
3.各模块调用关系如下:
3
主函数
s
e
i
shortestpath
Exit
Information
4.3 详细设计1.有向网节点结构体类型定义: typedef struct { char name[100] ; int number; char introduce[100]; }Vertex; 2. 主程序和其它主要函数伪码算法 1)主程序 int main() { char i; printf(" Welcome to use the shandong university of science and technology of
navigation system\n\n\n\n"); init(); map(); char c; do { printf("Please enter the 's' to query the shortest path\n"); printf("Please enter the 'i' to query information\n");
4
printf("Please input 'e' to exit the program\n\n\n"); loop: scanf("%c",&c); if(c >= 'A' && c <= 'Z') { c += 32; } if(c == '\n') { goto loop; } if(c != '\n') { if(c == 's') { shortestpath(); continue; } else if(c == 'i') { Information(); continue; } else if(c == 'e') { printf("\n\n\n\t\t\t\tThank you for you use\n\n\n"); return 0; } else
5
{ printf("input error!!!\n"); continue; } } }while(1); return 0; } 2)赋值 init 函数 void init() { int i, j; vertex[1].number = 1; strcpy(vertex[1].name,"Area C dormitory building"); strcpy(vertex[1].introduce, "Area C student rest area"); vertex[2].number = 2; strcpy(vertex[2].name, "Area A dormitory building"); strcpy(vertex[2].introduce,"Area A student rest area"); vertex[3].number = 3; strcpy(vertex[3].name, "Area B dormitory building"); strcpy(vertex[3].introduce,"Area B student rest area"); vertex[4].number = 4; strcpy(vertex[4].name, "Area C restaurant"); strcpy(vertex[4].introduce,"Area C student dining area"); vertex[5].number = 5; strcpy(vertex[5].name,"Area A restaurant"); strcpy(vertex[5].introduce,"Area A student dining area"); vertex[6].number = 6; strcpy(vertex[6].name,"Area B restaurant");
6
strcpy(vertex[6].introduce,"Area B student dining area"); vertex[7].number = 7; strcpy(vertex[7].name,"library"); strcpy(vertex[7].introduce,"Student borrowing books area"); /*vertex[7].number = 8; strcpy(vertex[7].name,"Area A restaurant"); strcpy(vertex[7].introduce,"Area A student dining area");*/ vertex[8].number = 8; strcpy(vertex[8].name,"No. 1 teaching building"); strcpy(vertex[8].introduce,"Students in class area"); vertex[9].number = 9; strcpy(vertex[9].name,"No. 13 teaching building"); strcpy(vertex[9].introduce,"Information institute, college building"); for(i = 1; i < MAX_VERTEX_NUM; ++i) { for(j = 1; j < MAX_VERTEX_NUM; ++j) { dist[i][j] = INFINITY; } } for(i = 1; i < MAX_VERTEX_NUM; ++i) { dist[i][i] = 0; } dist[1][2] = dist[2][1] = 20; dist[2][3] = dist[3][2] = 40; dist[1][4] = dist[4][1] = 50; dist[2][5] = dist[5][2] = 30; dist[3][6] = dist[6][3] = 50
;
7
dist[4][5] = dist[5][4] = 70; dist[5][6] = dist[6][5] = 90; dist[4][7] = dist[7][4] = 100; dist[5][8] = dist[8][5] = 120; dist[6][9] = dist[9][6] = 80; dist[7][8] = dist[8][7] = 60; dist[8][9] = dist[9][8] =120; } 3)输出山东科技大学平面图的 map …… 此处隐藏:6692字,全部文档内容请下载后查看。喜欢就下载吧 ……
相关推荐:
- [高中教育]电子线路高频非线性部分2.1
- [高中教育]中班美术活动——我的小手
- [高中教育]常用三极管参数大全
- [高中教育]计算机常见故障及解决办法
- [高中教育]风机基础环水平度控制方法探讨
- [高中教育]机械安全工程(专升本)阶段性作业3
- [高中教育]2009年安徽省高考语文考试说明刍议
- [高中教育]unit5 let's eat公开课教案设
- [高中教育]计算机网络原理课后习题答案
- [高中教育]2016-2022年中国新能源市场研究与投资
- [高中教育]2015-2020年中国会议行业市场评估及投
- [高中教育]经销商大会峰会主持人串词开场白
- [高中教育]2014新版北师大数学三年级上册小熊购物
- [高中教育]七年级第一学期体育与健康全套教案
- [高中教育]第三章:国际金融市场
- [高中教育]六年级下册数学单元测试-2.比例 北师大
- [高中教育]2016年上海海事大学法学院624刑法之《
- [高中教育]中国碳化钙产业竞争现状及未来五年投资
- [高中教育]网络时代,我们怎么玩
- [高中教育]圆锥曲线——高中数学基础知识与典型例
- 高集医院世界艾滋病宣传日活动方案
- 苏教版六年级英语上册期末试卷含答案
- 全民枪战生化英雄模式幽灵怎么玩 生化
- 灿烂的宋元文化一导学案
- 第2章货币资金与应收款项
- 北师大版八年级下册数学第三章《分式》
- 浅析高分子材料成型加工技术
- 华南理工大学2013年度共青团先进集体及
- 教师资格科目二小学教案模板(共合集)
- 工程扩建可研报告
- 中华人民共和国海事局2014年度招录公务
- 提高农村小学生作文能力的教学尝试
- 徒手心肺复苏术操作步骤
- 毛概试题库7-15章
- 2014-2015学年度(上)初中班主任工作计
- 企业驾驶员安全生产责任书
- 第07章 不等式测试题-2016年高考文科数
- 医疗器械经营企业工作程序
- 考研英语必背36篇_彩版_精华
- 初中9月13-15假期作业 (1)




