|
|
@ -227,4 +227,86 @@ void print() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
printf("\n");
|
|
|
|
printf("\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int main()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
creatnode();
|
|
|
|
|
|
|
|
createlist();
|
|
|
|
|
|
|
|
//createfile();
|
|
|
|
|
|
|
|
//printff();
|
|
|
|
|
|
|
|
int n=10;
|
|
|
|
|
|
|
|
printf("正在初始化数据,请稍候!\n");
|
|
|
|
|
|
|
|
//proc();
|
|
|
|
|
|
|
|
printf("欢迎使用本系统!\n");
|
|
|
|
|
|
|
|
while(n){
|
|
|
|
|
|
|
|
printf("欢迎来到上海市地铁交通服务平台!\n");
|
|
|
|
|
|
|
|
printf("1.最佳出行线路推荐\n");
|
|
|
|
|
|
|
|
printf("2.出行费用预估\n");
|
|
|
|
|
|
|
|
printf("0.退出系统!\n");
|
|
|
|
|
|
|
|
printf("请输入!\n");
|
|
|
|
|
|
|
|
scanf("%d",&n);
|
|
|
|
|
|
|
|
char str[100];
|
|
|
|
|
|
|
|
int n9,n10;
|
|
|
|
|
|
|
|
switch(n){
|
|
|
|
|
|
|
|
case 1:printf("请输入起点\n");
|
|
|
|
|
|
|
|
scanf("%s",str);
|
|
|
|
|
|
|
|
n9=-1;
|
|
|
|
|
|
|
|
for(int i=0;i<nm.n;i++){
|
|
|
|
|
|
|
|
if(!strcmp(str,nm.adjust[i].name)){
|
|
|
|
|
|
|
|
n9=i;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(n9==-1) {
|
|
|
|
|
|
|
|
printf("站点输入错误\n");
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
n10=-1;
|
|
|
|
|
|
|
|
printf("请输入终点\n");
|
|
|
|
|
|
|
|
scanf("%s",str);
|
|
|
|
|
|
|
|
for(int i=0;i<nm.n;i++){
|
|
|
|
|
|
|
|
if(!strcmp(str,nm.adjust[i].name)){
|
|
|
|
|
|
|
|
n10=i;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(n10==-1) {
|
|
|
|
|
|
|
|
printf("站点输入错误\n");
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Dijkstra(n9,n10);
|
|
|
|
|
|
|
|
case 2:printf("请输入起点\n");
|
|
|
|
|
|
|
|
str[100];
|
|
|
|
|
|
|
|
scanf("%s",str);
|
|
|
|
|
|
|
|
n9=-1;
|
|
|
|
|
|
|
|
for(int i=0;i<nm.n;i++){
|
|
|
|
|
|
|
|
if(!strcmp(str,nm.adjust[i].name)){
|
|
|
|
|
|
|
|
n9=i;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(n9==-1) {
|
|
|
|
|
|
|
|
printf("站点输入错误\n");
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
n10=-1;
|
|
|
|
|
|
|
|
printf("请输入终点\n");
|
|
|
|
|
|
|
|
scanf("%s",str);
|
|
|
|
|
|
|
|
for(int i=0;i<nm.n;i++){
|
|
|
|
|
|
|
|
if(!strcmp(str,nm.adjust[i].name)){
|
|
|
|
|
|
|
|
n10=i;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(n10==-1) {
|
|
|
|
|
|
|
|
printf("站点输入错误\n");
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Dijkstra(n9,n10);
|
|
|
|
|
|
|
|
printf("预估消费%d元\n",money);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 0: return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|