📄 cpp1.cpp
字号:
#include "iostream.h"
#include "Graph.h"
main()
{
char a[10];
long pathlength;
int st=0,nd=0;
Path p[25];
MGraph mGraph;
cout<<" ***************你必须打入该城市的汉语拼音运行*********************"<<endl;
cout<<endl;
cout<<" input the begin city:";
cin>>a;
st=mGraph.SearchVex(a);
cout<<endl;
cout<<" input the ultimate city:";
cin>>a;
nd=mGraph.SearchVex(a);
if(st==25||nd==25){cout<<"\n input error";return 1;}
if(st!=nd)
{mGraph.ShortestPath(st,nd,pathlength,p);
cout<<endl;
cout<<" the best path:";
for(int i=0;i<p[nd].num;i++)
mGraph.PrintVex(p[nd].VPath[i]);
cout<<endl;
cout<<" 距离为:"<<pathlength<<"公里";
}
else
cout<<" 在同一城市来往,距离为零。";
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -