f6zx3qc123 2014-12-18 12:40 采纳率: 0%
浏览 1731

求解这个简单的数据结构错在哪里?菜鸟急求

#include
typedef int DataType;
#define MaxSize 20
#define MaxVertices 20
#define MaxWeight 10000
#include
#include

typedef struct {
DataType list[MaxSize];
int size;
}Seqlist;
typedef struct
{
SeqList Vertices;
int edge[MaxVertices][MaxVertices];
int numOfEdges;

}AdjMGraph;
void Initiate(AdjMGraph G, int n)

{
int i, j;
for(i = 0; i < n; i++)
for(j = 0; j < n; j++)
{
if(i == j) G->edge[i][j] = 0;
else G->edge[i][j] = MaxWeight;
}
G->numOfEdges = 0; /
边的条数置为0*/
ListInitiate(&G->Vertices); /*顺序表初始化*/
}
void InsertVertex(AdjMGraph G, DataType vertex)
{
ListInsert(&G->Vertices, G->Vertices.size, vertex);
}
void InsertEdge(AdjMGraph *G, int v1, int v2, int weight)
{
if(v1 < 0 || v1 > G->Vertices.size || v2 < 0 || v2 > G->Vertices.size)
{ printf("参数v1或v2越界出错!\n");

exit(1);
}
G->edge[v1][v2] = weight;
G->numOfEdges++;
}
typedef struct
{
int row; //行下标
int col; //列下标
int weight; //权值
} RowColWeight;
void CreatGraph(AdjMGraph *G, DataType V[],int n,RowColWeight E[],int e)
/
在图G中插入n个顶点信息V和e条边信息E*/
{
int i, k;
Initiate(G, n); /*顶点顺序表初始化*/
for(i = 0; i < n; i++)
InsertVertex(G, V[i]); /*顶点插入*/
for(k = 0; k < e; k++)
InsertEdge(G, E[k].row, E[k].col, E[k].weight);

}

void main (void)
{
AdjMGraph g1;
DataType a[]={'1','2','3','4','5','6'};
RowColWeight rcw[]={{0,1,3},{0,2,2},{0,3,6},{1,2,3},{2,3,6},{1,4,6},{2,4,4},{2,5,5},{
3,5,1},{4,5,1},{1,0,3},{2,0,2},{3,0,6},{2,1,3},{3,2,6},{4,1,6},{4,2,4},{5,2,5},
{5,3,1},{5,4,1}};
int n=6,e=10;
GreatGraph(&g1,a,n,rcw,e);
printf("顶点集合为:");
for(i=0;i<=g1.Vertices.size;i++)
printf("%c",g1.Vertices.list[i]);
printf("\n");
printf("权值集合为:\n");
for(i=0;i<=g1.Vertices.size;i++)
{
for(j=0;j<=g1.Vertices.size;j++)
printf("%5d",g1.edge[i][j]);
printf("\n");
}
}

Cannot open include file: 'AdjMGraph.h': No such file or directory
执行 cl.exe 时出错. 出现这样的问题该怎么解决了!!!

  • 写回答

2条回答 默认 最新

  • save4me 2014-12-18 13:01
    关注

    你的这段代码里有include 'AdjMGraph.h',并且文件夹有这个文件吗?如果没有这个头文件,要么创作文件,要么删除这个include

    评论

报告相同问题?

悬赏问题

  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3