c语言版的数据结构课设-校园导游咨询!!!急急急!!

来源:百度知道 编辑:UC知道 时间:2024/06/11 10:47:19

我只有C++的~~

#include<iostream>
#include<string>
using namespace std;
#define MaxVertexNum 50 /*景点个数最大50*/
#define MAXCOST 1000 /*定义路径的无穷大*/
#define T 8 /*目前景点个数*/

typedef struct
{
char name[20]; /*景点名称*/
char number[15]; /*景点代号*/
char introduce[100]; /*景点简介*/
}Elemtype;
typedef struct
{
int num; /*顶点编号*/
Elemtype date; /*顶点信息*/
}Vertex; /*定义顶点*/

typedef struct
{
Vertex vexs[MaxVertexNum]; /*存放顶点的一维数组,数组第零个单元没有用上*/
unsigned int edges[MaxVertexNum][MaxVertexNum]; /*存放路径的长度*/
int n,e;
}MGraph;

MGraph MGr; /*全局变量,定义MGr为MGraph类型*/
int shortest[MaxVertexNum][MaxVertexNum]; /*定义全局变量存贮最小路径*/
int path[MaxVertexNum][MaxVertexNum]; /*定义存贮路径*/

void init()
{
int i,j;
MGr.vexs[1].num=1;
strcpy(MGr.vexs[1].date.name