資源簡介
用c語言編寫的公園導游圖系統代碼,解決數據結構中公園導游圖問題

代碼片段和文件信息
#include?
#include?
/*定義符號常量*/?
#define?INT_MAX?10000?
#define?n?10?
/*定義全局變量*/?
int?cost[n][n];/*?邊的值*/?
int?shortest[n][n];/*?兩點間的最短距離*/?
int?path[n][n];/*?經過的景點*/?
/*自定義函數原型說明*/?
int?shortestdistance();
void?floyed();?
void?display(int?iint?j);
?
void?main()?/*主函數*/
{?
????int?ij;?
????char?k;?
????for(i=0;i<=n;i++)?
???????for(j=0;j<=n;j++)?
???{
???cost[i][j]=INT_MAX;?
???????????cost[1][3]=cost[3][1]=200;?
???????????cost[2][3]=cost[3][2]=100;?
???????????cost[2][4]=cost[4][2]=200;?
???????????cost[3][10]=cost[10][3]=400;?
???????????cost[1][10]=cost[10][1]=400;?
???????????cost[2][10]=cost[10][2]=400;?
???????????cost[4][10]=cost[10][4]=400;?
???????????cost[1][4]=cost[4][1]=500;?
???????????cost[4][5]=cost[5][4]=300;?
???????????cost[4][9]=cost[9][4]=400;?
???????????cost[5][9]=cost[9][5]=800;?
???????????cost[5][7]=cost[7][5]=400;?
???????????cost[5][6]=cost[6][5]=200;?
???????????cost[6][7]=cost[7][6]=100;?
???????????cost[7][8]=cost[8][7]=300;?
???????????cost[8][6]=cost[6][8]=400;?
???????????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;?
???}
?????while(1)?
?{??printf(“????\n“);
printf(“*******************************************************************************\n“);
????????printf(“**????????----------------歡迎使用該公園導游系統!----------------????????????**\n“);?
????????printf(“*******************************************************************************\n“);
printf(“**?????????????????????????公園地圖如下:?????????????????????????????????????**\n“);
????printf(“**??????????????????????????<景點9>??????????????????????????????????????????**\n“);
????printf(“**????????????????????????????.?????.????????????????????????????????????????**\n“);
????printf(“**??????????????????????????.??????????.?????????????????????????????????????**\n“);
????printf(“**???????????????????<景點8>??????????????.??????????????????????????????????**\n“);
????printf(“**??????????????????????.??????????<景點6>????.??????????????????????????????**\n“);
????printf(“**????????????????????.???????????????.????.?????.???????????????????????????**\n“);
????printf(“**?????????????<景點5>??????????????.?????????.????.?????????????????????????**\n“);
????printf(“**??????????????????.??.???????????.?????????????.???.???????????????????????**\n“);
????printf(“**???????????????????.???.<景點4>.??.??.??.??.??.<景點7>?????????????????????**\n“);
????printf(“**????????????????????.????.????.??????????????????.?????????????????????????**\n“);
????printf(“**?????????????????????.??????.???.???????????????.??????????????????????????**\n“);
????printf(“**??????????????????????.???.??<景點3>??????????.????????????????????????????**\n“);
????printf(“**??????????????????<景點2>????.????.?????????.??????????????????????????????**\n“);
????printf(“**?????????????????????????.???????.?????景點1>???????????????????????????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????7570??2009-07-18?09:30??111.cpp
-----------?---------??----------?-----??----
?????????????????7570????????????????????1
- 上一篇:漢明碼的編碼譯碼的C語言實現
- 下一篇:C++公司人事管理課程設計
評論
共有 條評論