没有合适的资源?快使用搜索试试~ 我知道了~
火车查询系统提供对城市信息进行编辑(如:添加或删除)的功能。
需积分: 9 10 下载量 75 浏览量
2009-07-15
22:16:06
上传
评论 1
收藏 10KB TXT 举报
温馨提示
试读
13页
(1) 提供对城市信息进行编辑(如:添加或删除)的功能。 (2) 城市之间有两种交通工具:火车和飞机。提供对列车时刻表和飞机航班进行编辑(增设或删除)的功能。 (3) 提供两种最优决策:最快到达或最省钱到达。全程只考虑一种交通工具; (4) 旅途中耗费的总时间应该包括中转站的等候时间; (5) 咨询以用户和计算机的对话方式进行。由用户输入起始站、终点站、最优决策原则和交通工具,输出信息:最快需要多长时间才能到达或者最少需要多少旅费才能到达,并详细说明依次于何时乘坐哪一趟列车或哪一次班机到何地。
资源推荐
资源详情
资源评论
#include"iostream.h"
#include"stdio.h"
#include"stdlib.h"
#define INFINITY 50000
#define MAX_VERTEX_NUM 25
#define OVERFLOW -1
#define OK 1
#define ERROR 0
#define STACK_INIT_SIZE 100
#define STACKINCREMENT 10
typedef struct
{
char *time[2]; //起始终点时刻
int banci; //车次
int money; //车费
}Arc;
typedef struct ArcCell
{
int distance;
Arc Ar[5];
int banum; //车次的数量
}AerCell,AdjMatrix[MAX_VERTEX_NUM][MAX_VERTEX_NUM];
typedef struct
{
char *vexs[MAX_VERTEX_NUM]; //顶点向量
AdjMatrix arcs; //邻接矩阵
int vexnum,arcnum;
}MGraph;
typedef struct
{
#include"stdio.h"
#include"stdlib.h"
#define INFINITY 50000
#define MAX_VERTEX_NUM 25
#define OVERFLOW -1
#define OK 1
#define ERROR 0
#define STACK_INIT_SIZE 100
#define STACKINCREMENT 10
typedef struct
{
char *time[2]; //起始终点时刻
int banci; //车次
int money; //车费
}Arc;
typedef struct ArcCell
{
int distance;
Arc Ar[5];
int banum; //车次的数量
}AerCell,AdjMatrix[MAX_VERTEX_NUM][MAX_VERTEX_NUM];
typedef struct
{
char *vexs[MAX_VERTEX_NUM]; //顶点向量
AdjMatrix arcs; //邻接矩阵
int vexnum,arcnum;
}MGraph;
typedef struct
{
int *top;
int *base;
int stacksize;
}Stack;
void InitStack(Stack &S)
{
S.base=(int *)malloc(STACK_INIT_SIZE*sizeof(int));
if(!S.base) exit(OVERFLOW);
S.top=S.base;
S.stacksize=STACK_INIT_SIZE;
}
void Push(Stack &S,int e)
{
if(S.top-S.base>=S.stacksize)
{
S.base=(int *)realloc(S.base,(S.stacksize+STACKINCREMENT)*sizeof(int));
if(!S.base) exit(OVERFLOW);
S.top=S.base+S.stacksize;
S.stacksize+=STACKINCREMENT;
}
*S.top++=e;
}
int Pop(Stack &S)
{
int e;
if(S.top==S.base) return ERROR;
e=*--S.top;
return e;
}
int *base;
int stacksize;
}Stack;
void InitStack(Stack &S)
{
S.base=(int *)malloc(STACK_INIT_SIZE*sizeof(int));
if(!S.base) exit(OVERFLOW);
S.top=S.base;
S.stacksize=STACK_INIT_SIZE;
}
void Push(Stack &S,int e)
{
if(S.top-S.base>=S.stacksize)
{
S.base=(int *)realloc(S.base,(S.stacksize+STACKINCREMENT)*sizeof(int));
if(!S.base) exit(OVERFLOW);
S.top=S.base+S.stacksize;
S.stacksize+=STACKINCREMENT;
}
*S.top++=e;
}
int Pop(Stack &S)
{
int e;
if(S.top==S.base) return ERROR;
e=*--S.top;
return e;
}
剩余12页未读,继续阅读
资源评论
asddf12344
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功