This is the code:
The previously defined:
Int quanzhi [110] [110], vitamin k [110], zuiduan [110].
Struct AG//define structure storage attractions information
{
Char mingzi [50].
Char xinxi [500].
} q [100];
Di jie tesla function:
Void Dijkstra (int where v0, int s)//Dijkstra shortest path, and the output route
{
Int min, I, j, u, v.
Int p [110], [110] l;
Memset (p, 1, sizeof (p));//p to follow to the length of sizeof (p) of space - 1 (initialized memset bytes, sizeof computing storage bytes)
Memset (l, 0, sizeof (l));//the point to the length of the l for sizeof (l) of the space s.
Memset (vitamin k, 0, sizeof (vitamin k));//the vitamin k to the length of the for sizeof (vitamin k) of the space s.
for(i=1; i<=15; I++)
{
Zuiduan [I]=quanzhi [where v0] [I];
If (zuiduan [I]
}
Vitamin k [where v0]=1;
for(i=1; i<15. I++)
{
Min=MAXSIZE;
for(j=1; J<=15; J++)//every time to find the point nearest to where v0
{
If (vitamin k [j]==0 & amp; & Zuiduan [j]
Min=zuiduan [j];
U=j;
}
}
Vitamin k [u]=1;//tag that point
For (n=1; V<=15; V++)
{
If (vitamin k [v]==0 & amp; & Zuiduan [v] & gt; Quanzhi zuiduan [u] + [u] [v])//through the closest point update other side
{
P=u [v];//store update, is the line
Zuiduan [v]=zuiduan quanzhi [u] + [u] [v];
}
}
}
V=s;
i=1;
While (p [v]!=where v0)//will route in the stack, positive sequence output
{
L=p [v] [i++];
V=p [v];
}
Cout
Cout<& lt;" Route: "& lt;
{
Cout}
CoutCout<& lt;" The shortest path length is: "& lt;
}