#define MAXVEX 20
#define null -1
typedef char VexType;
typedef float AdjType;
typedef struct
{ VexType vexs[MAXVEX]; /* 顶点信息 */
AdjType arcs[MAXVEX][MAXVEX]; /* 边信息 */
int n; /* 图的顶点个数 */
}GraphMatrix;
int firstVertex(GraphMatrix* pgraph)
{
if(pgraph->n==0)
return null;
else return 0;
}
int nextVertex(GraphMatrix* pgraph,int n)
{
if(n==pgraph->n-1)
return null;
else return n+1;
}
int firstAdjacent(GraphMatrix* pgraph, int i)
{ int k;
for(k=0;k<pgraph->n;k++)
if(pgraph->arcs[i][k]!=0) return k;
return null;
}
int nextAdjacent(GraphMatrix* pgraph, int i, int j)
{ int k;
for(k=j+1; k<pgraph->n; k++)
if(pgraph->arcs[i][k]!=0) return k;
return null;
}
int main(){
int i,j;
printf("input the number of the vex;");
scanf("%d",&struct GraphMatrix.n);
printf("dingdian:");
for(i=0;i<struct GraphMatrix.n;i++)
scanf("%s",struct GraphMatrix.vexs);
printf("adj");
for(i=0;i<struct GraphMatrix.n;i++)
{ for(j=0;j<i;j++)
scanf("%f",&struct GraphMatrix.arcs[i][j]);
}
return 0;
}
这是关于一个邻接矩阵的程序。谁能帮我看下错哪了?