资源简介
两地铁站之间所有路径,两地铁站之间所有路径,两地铁站之间所有路径

代码片段和文件信息
// Route.cpp : 定义控制台应用程序的入口点。
//
#include “stdafx.h“
#include “string.h“
#include
#include
#include
using namespace std;
#define VerNum 9
#define EdgeNum 21
typedef struct VNode{
char id[10];
int index;
int tag;
}VNode;
typedef struct linkNode{
char id[10];
struct linkNode *pre;
struct linkNode *next;
}linkNode;
typedef struct EdgeNode{
char start[10];
char end[10];
linkNode *first;
}EdgeNode;
VNode *node;
int edge[VerNum][VerNum] = {
{011-11-1-1-1-1}
{10-1-1-11-1-1-1}
{1101-11-1-1-1}
{-1-1101-11-1-1}
{1-1-110-111-1}
{-111-1-101-11}
{-1-1-1111011}
{-1-1-1-11-1-101}
{-1-1-1-1-11110}
};
EdgeNode Edge[EdgeNum];
typedef struct Node{
int index;
int tag;
}Node;
typedef struct Stack{
Node node[VerNum];
int top;
}Stack;
int tagTransfer[4];
char preStr[100];
char endStr[100];
char preStation[10];
void creatGraph();
void push(Stack &sNode node);
void pop(Stack &s);
Node getTop(Stack s);
bool stackEmpty(Stack s);
void findRoute(Stack stackint a1int a2);
int getIndex(char temp[]);
void outputStation(char str1[]char str2[]);
int _tmain(int argc _TCHAR* argv[])
{
creatGraph();
Stack stack;
stack.top = 0;
char source[20];
char destination[20];
int a1 a2;
printf(“输入起始和终止站点:“);
while (scanf(“%s %s“ source destination)!=EOF){
a1 = -1;
a2 = -1;
for (int i = 0; i < VerNum; i++){
if (strcmp(node[i].id source) == 0){
a1 = node[i].index;
}
if (strcmp(node[i].id destination) == 0){
a2 = node[i].index;
}
}
tagTransfer[0] = -1;
tagTransfer[1] = -1;
tagTransfer[2] = -1;
tagTransfer[3] = -1;
if (a1 == -1){
for (int i = 0; i < EdgeNum; i++){
linkNode *phead = Edge[i].first;
while (phead != NULL){
if (0 == strcmp(phead->id source)){
for (int j = 0; j < VerNum; j++){
if (0 == strcmp(Edge[i].start node[j].id)){
tagTransfer[0] = node[j].index;
}
if (0 == strcmp(Edge[i].end node[j].id)){
tagTransfer[1] = node[j].index;
}
}
break;
}
phead = phead->next;
}
}
}
if (a2 == -1){
for (int i = 0; i < EdgeNum; i++){
linkNode *phead = Edge[i].first;
while (phead != NULL){
if (0 == strcmp(phead->id destination)){
for (int j = 0; j < VerNum; j++){
if (0 == strcmp(Edge[i].start node[j].id)){
tagTransfer[2] = node[j].index;
}
if (0 == strcmp(Edge[i].end node[j].id)){
tagTransfer[3] = node[j].index;
}
}
break;
}
phead = phead->next;
}
}
}
if (a1 != -1 && a2 != -1){
findRoute(stack a1 a2);
}
if (tagTransfer[0] == tagTransfer[2] && tagTransfer[1] == tagTransfer[3]){
int b1 = getIndex(source);
int b2 = getIndex(destination);
int tagK = 0;
for (int i = 0; i < EdgeNu
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 123392 2019-03-26 16:51 Route\Debug\Route.exe
文件 903840 2019-03-26 16:51 Route\Debug\Route.ilk
文件 2345984 2019-03-26 16:51 Route\Debug\Route.pdb
文件 525 2019-03-26 10:01 Route\Debug\station.csv
文件 52 2019-03-26 09:20 Route\Debug\transfer.csv
文件 2949120 2019-03-26 16:53 Route\ipch\route-7f2e0489\route-9a1a9cbb.ipch
文件 2949120 2019-03-25 22:04 Route\ipch\route-bd57b3f9\route-9a1a9cbb.ipch
文件 2949120 2019-04-01 08:13 Route\ipch\route-f61ec921\route-9a1a9cbb.ipch
文件 2684 2019-03-26 16:51 Route\Route\Debug\Route.log
文件 344856 2019-03-26 16:51 Route\Route\Debug\Route.obj
文件 1703936 2019-03-26 09:13 Route\Route\Debug\Route.pch
文件 3194 2019-03-26 16:51 Route\Route\Debug\Route.tlog\cl.command.1.tlog
文件 14174 2019-03-26 16:51 Route\Route\Debug\Route.tlog\CL.read.1.tlog
文件 1300 2019-03-26 16:51 Route\Route\Debug\Route.tlog\CL.write.1.tlog
文件 2716 2019-03-26 16:51 Route\Route\Debug\Route.tlog\li
文件 2910 2019-03-26 16:51 Route\Route\Debug\Route.tlog\li
文件 698 2019-03-26 16:51 Route\Route\Debug\Route.tlog\li
文件 197 2019-03-26 16:51 Route\Route\Debug\Route.tlog\Route.lastbuildstate
文件 11962 2019-03-26 09:13 Route\Route\Debug\stdafx.obj
文件 322560 2019-03-26 16:51 Route\Route\Debug\vc120.idb
文件 438272 2019-03-26 16:51 Route\Route\Debug\vc120.pdb
文件 1496 2019-03-25 19:32 Route\Route\ReadMe.txt
文件 17170 2019-03-26 16:53 Route\Route\Route.cpp
文件 4553 2019-03-25 22:04 Route\Route\Route.vcxproj
文件 1312 2019-03-25 19:32 Route\Route\Route.vcxproj.filters
文件 525 2019-03-26 10:01 Route\Route\station.csv
文件 211 2019-03-25 19:32 Route\Route\stdafx.cpp
文件 234 2019-03-25 19:32 Route\Route\stdafx.h
文件 236 2019-03-25 19:32 Route\Route\targetver.h
文件 52 2019-03-26 09:20 Route\Route\transfer.csv
............此处省略17个文件信息
- 上一篇:RK芯片资料合集
- 下一篇:FM1702NL/FM1722硬件SPI读写程序
相关资源
- ArcGIS Engine最优路径分析
- 路由选择算法源程序(最短路径算法
- 不同加载路径对钢筋混凝土L形柱抗震
- 基于改进势场栅格法的移动机器人路
- 基于改进人工势场的矿井导航装置路
- 利用改进人工势场法的智能车避障路
- 基于改进人工势场法的救灾机器人路
- 传统产业数字化转型的模式和路径
- PathSim代码实现
- 基于A_算法的空间机械臂避障路径规划
- 一种新型基于多点预瞄的最优路径跟
- 论文研究 - 大数据背景下幼儿教师专
- 基于一种改进RRT算法的足球机器人路
- RRT路径规划算法论文
- 交通咨询模拟系统
- 就业期望偏差视阈下高校毕业生就业
- 生态文明视阈下的绿色生态矿业发展
- “工匠精神”在辅导员队伍中的
- “PPP模式”在大都市郊野公园建
- PAT蓝桥LeetCode学习路径刷题经验.pdf
- 多移动agv小车的路径规划技术的研究
- 移动机器人路径规划与运动控制
- 论文+人工势场法。机器人路径规划
- stm32智能小车/数组控制小车路径/避障
- 基于A_算法的三维地图最优路径规划
- A*DijkstraBFS路径搜寻算法演示程序
- ArduPilot——L1 control 中文翻译版
- 最短路径数据结构作业-南京地图
- 北京地铁最短路线含4W条路径,250个站
- 动态规划算法解决最优路径规划
评论
共有 条评论