【正文】
課程設計報告書課程名稱 數(shù)據(jù)結構 設計題目 校園導航系統(tǒng) 專業(yè)班級 計算機114 班 目錄……………………………………………… 2……………………………………………… 2……………………………………………… 2……………………………………………… 2………………………………………………… 2………………………………………………… 3………………………………………………… 4………………………………………………12…………………………………………………………12…………………………………………………………13 附錄………………………………………………………145 總結與展望…………………………………………… 20……………………………………………… 21……………………………………………… 211 設計時間 2013年12月3日2 設計目的1.加深對《數(shù)據(jù)結構》這一課程所學內(nèi)容的進一步理解與鞏固2.通過完成課程設計,逐漸培養(yǎng)自己的編程能力;3.培養(yǎng)給出題目后,構建框架,用計算機解決的能力;4.通過調(diào)試程序積累調(diào)試C程序設計的經(jīng)驗; 3設計任務給出校園各主要建筑的名稱信息及有線路聯(lián)通的建筑之間的距離,利用校園導航系統(tǒng)計算出給定的起點到終點之間的最近距離及線路。4 設計內(nèi)容 1.程序所能達到的功能: (1) map——輸出山東科技大學平面圖。(2) init()——按相應編號輸入各個節(jié)點內(nèi)容,對相應路徑賦值的函數(shù)。(3) floyd() 弗洛伊德求最短路徑(4) information()——輸出簡介的函數(shù)(5) Path()——最短路徑的輸出函數(shù)(6) shortestpath()——調(diào)用弗洛伊德和最短路徑輸出的函數(shù)(7) main()——主函數(shù)2.輸入的形式和輸入值的范圍:輸入數(shù)字和字母: 字母:以s查詢最短路徑;以i查詢信息;以e退出程序。 數(shù)字:從1到9輸入。3.輸出的形式:從A到B得最短路徑為: A到C到D到B 最短距離為:xxx米。4.測試數(shù)據(jù)包括在正確的輸入及輸出結果及含有錯誤的輸入及輸出結果:Input:sOutput:Please enter the number two to query : 1 7 Output:The shortest path from Area C dormitory building to library is: Area C dormitory buildingArea C restaurantlibrary。 The shortest distance is:150meters.Input:i Output:Please enter the number of query site: 3Output:@name: Area B dormitory building @introduction:Area B student rest areainput:e output:Thank you for you use 1.抽象數(shù)據(jù)類型定義typedef struct{ char name[100] 。 int number。 char introduce[100]。}Vertex。2.主程序模塊的整體流程 進入主函數(shù),調(diào)用init(),map()。選擇“s”,調(diào)用shortestpath函數(shù),并同時調(diào)用floyd和way函數(shù)。選擇“i”,調(diào)用information函數(shù)選擇“e”,退出。: 主函數(shù) e i s shortestpath Information Exit:typedef struct{ char name[100] 。 int number。 char introduce[100]。}Vertex。2. 主程序和其它主要函數(shù)偽碼算法1)主程序int main(){ char i。 printf( Wele 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 39。s39。 to query the shortest path\n)。 printf(Please enter the 39。i39。 to query information\n)。 printf(Please input 39。e39。 to exit the program\n\n\n)。 loop: scanf(%c,amp。c)。 if(c = 39。A39。 amp。amp。 c = 39。Z39。) { c += 32。 } if(c == 39。\n39。) { goto loop。 } if(c != 39。\n39。) { if(c == 39。s39。) { shortestpath()。 continue。 } else if(c == 39。i39。) { Information()。 continue。 } else if(c == 39。e39。) { printf(\n\n\n\t\t\t\tThank you for you use\n\n\n)。 return 0。 } else { printf(input error!!!\n)。 continue。 } } }while(1)。 return