資源簡介
設(shè)計你的學(xué)校的校園平面圖,所含景點不少于10個。以圖中頂點表示學(xué)校各景點,存放景點名稱,代號,簡介等信息;以邊表示路徑,存放路徑長度等相關(guān)信息。要求:1)在屏幕上畫出簡單的校園平面圖。2)為來訪客人提供圖中任意景點的問路查詢,即查詢?nèi)我鈨蓚€景點之間的一條最短的簡單路徑。3)為來訪客人提供圖中任意景點相關(guān)信息的查詢。
代碼片段和文件信息
#include
#include
/*定義符號常量*/
#define?Max?100
#define?N?10
/*定義全局變量*/
typedef?int?AdjMatrix[N][N];
typedef?struct
{
int?vexs[Max];
????AdjMatrix?arcs;
}Matrix_Graph;
int?cost[N][N];/*?邊的值*/
int?shortest[N][N];/*?兩點間的最短距離*/
int?path[N][N];/*?經(jīng)過的景點*/
/*自定義函數(shù)原型說明*/
void?creat();
int??shortestdistance();
void?floyed();
void?display(int?iint?j);
void?information(int?i);
void?creat()
{
int?ij;
????for(i=0;i<=N;i++)
for(j=0;j<=N;j++)
cost[i][j]=Max;
?cost[1][2]=cost[2][1]=2;
?cost[1][3]=cost[3][1]=3;
?cost[2][4]=cost[4][2]=5;
?cost[3][4]=cost[4][3]=3;
?cost[4][5]=cost[5][4]=2;
?cost[4][7]=cost[7][4]=5;
?cost[4][8]=cost[8][4]=9;
?cost[5][6]=cost[6][5]=4;
?cost[6][7]=cost[7][6]=3;
?cost[7][8]=cost[8][7]=4;
?cost[8][9]=cost[9][8]=6;
?cost[9][10]=cost[10][9]=5;
?cost[1][1]=cost[2][2]=cost[3][3]=cost[4][4]=cost[5][5]=0;
?cost[6][6]=cost[7][7]=cost[8][8]=cost[9][9]=cost[10][10]=0;
}
int?shortestdistance()
{
/*要查找
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????3413??2008-02-27?09:15??校園導(dǎo)游咨詢\chengxu.dsp
?????文件??????33792??2008-02-27?09:22??校園導(dǎo)游咨詢\Debug\vc60.idb
?????文件??????53248??2008-02-27?09:17??校園導(dǎo)游咨詢\Debug\vc60.pdb
?????文件?????212784??2008-02-27?09:15??校園導(dǎo)游咨詢\Debug\chengxu.pch
?????文件?????214500??2008-02-27?09:17??校園導(dǎo)游咨詢\Debug\chengxu.ilk
?????文件?????196662??2008-02-27?09:17??校園導(dǎo)游咨詢\Debug\chengxu.exe
?????文件?????476160??2008-02-27?09:17??校園導(dǎo)游咨詢\Debug\chengxu.pdb
?????文件??????19016??2008-02-27?09:17??校園導(dǎo)游咨詢\Debug\chengxu.obj
?????文件??????33792??2008-02-27?09:23??校園導(dǎo)游咨詢\chengxu.ncb
?????文件???????1218??2008-02-27?09:17??校園導(dǎo)游咨詢\chengxu.plg
?????文件?????????42??2007-07-10?14:21??校園導(dǎo)游咨詢\g1.txt
?????文件?????????42??2007-07-10?14:23??校園導(dǎo)游咨詢\g2.txt
?????文件?????????58??2007-07-10?14:23??校園導(dǎo)游咨詢\g3.txt
?????文件?????????34??2007-07-10?14:23??校園導(dǎo)游咨詢\g4.txt
?????文件?????????38??2007-07-10?14:24??校園導(dǎo)游咨詢\g5.txt
?????文件?????????32??2007-07-11?13:09??校園導(dǎo)游咨詢\g6.txt
?????文件?????????32??2007-07-10?14:24??校園導(dǎo)游咨詢\g7.txt
?????文件?????????26??2007-07-10?14:25??校園導(dǎo)游咨詢\g8.txt
?????文件?????????34??2007-07-10?14:25??校園導(dǎo)游咨詢\g9.txt
?????文件?????????37??2007-07-11?13:10??校園導(dǎo)游咨詢\g10.txt
?????文件???????4551??2008-02-27?09:17??校園導(dǎo)游咨詢\chengxu.cpp
?????文件?????361472??2008-02-27?09:23??校園導(dǎo)游咨詢\數(shù)據(jù)結(jié)構(gòu)課程設(shè)計.doc
?????文件??????48640??2008-02-27?09:23??校園導(dǎo)游咨詢\chengxu.opt
?????文件????????539??2008-02-27?09:23??校園導(dǎo)游咨詢\chengxu.dsw
?????文件?????196662??2008-02-27?09:17??校園導(dǎo)游咨詢\chengxu.exe
?????目錄??????????0??2008-02-27?09:15??校園導(dǎo)游咨詢\Debug
?????目錄??????????0??2008-02-25?21:45??校園導(dǎo)游咨詢
-----------?---------??----------?-----??----
??????????????1856824????????????????????27
............此處省略0個文件信息
- 上一篇:超級棒的表白源碼
- 下一篇:計算機復(fù)試上機題(王道天勤)pdf版
評論
共有 條評論