-
大小: 7KB文件類型: .cpp金幣: 1下載: 0 次發(fā)布日期: 2021-01-05
- 標(biāo)簽: 數(shù)據(jù)結(jié)構(gòu)??C??導(dǎo)游系統(tǒng)??
資源簡介
【數(shù)據(jù)結(jié)構(gòu)】用C實(shí)現(xiàn)校園導(dǎo)游系統(tǒng)
已經(jīng)驗(yàn)證,適合初學(xué)者適用~
代碼片段和文件信息
#include
#include
#include
using?namespace?std;
#define?MaxVertexNum??50???/*景點(diǎn)個(gè)數(shù)最大50*/
#define?MAXCOST??1000??????/*定義路徑的無窮大*/
#define?T?8????????????????/*目前景點(diǎn)個(gè)數(shù)*/
typedef?struct
{
????char?name[20];???????????/*景點(diǎn)名稱*/
????char?number[T];??????????/*景點(diǎn)代號*/
????char?introduce[100];?????/*景點(diǎn)簡介*/
}Elemtype;
typedef?struct
{
???int?num;????????????/*頂點(diǎn)編號*/
???Elemtype?date;??????/*頂點(diǎn)信息*/
}Vertex;???????????????/*定義頂點(diǎn)*/
typedef?struct
{
???Vertex?vexs[MaxVertexNum];???/*存放頂點(diǎn)的一維數(shù)組數(shù)組第零個(gè)單元沒有用上*/
???unsigned?int?edges[MaxVertexNum][MaxVertexNum];?/*存放路徑的長度*/
???int?ne;
}MGraph;
MGraph?MGr;????/*全局變量定義MGr為MGraph類型*/
int?shortest[MaxVertexNum][MaxVertexNum];??/*定義全局變量存貯最小路徑*/
int?path[MaxVertexNum][MaxVertexNum];??????/*定義存貯路徑*/
void?
評論
共有 條評論