qzjhjxj ###### 问题遇到的现象和发生背景
#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
#define MVNum 100
typedef char VerTexType;
typedef int ArcType;
typedef struct{
VerTexType vexs[MVNum];
ArcType arcs[MVNum] [MVNum];
int vexnum,arcnum;
}AMGraph;
int LocateVex(AMGraph *G,VerTexType v){
int i;
for(i=0;i<G->vexnum;i++){
if(G->vexs[i]==v)
return i;
}
return -1;
}
int CreateUDN(AMGraph *G){
int i,j,k;
VerTexType v1,v2;
printf("输入总点数:");
scanf("%d",&G->vexnum);
printf("\n输入总边数:");
scanf("%d",&G->arcnum);
printf("\n输入顶点信息:");
scanf("%s",G->vexs);
for(i=0;i<G->vexnum;i++){
for(j=0;j<G->vexnum;j++)
G->arcs[i][j]=0;
}
for(k=0;k<G->arcnum;k++){
printf("\n输入一条边依附的两个顶点:");
scanf("%c%c",&v1,&v2);
//printf("\n%c%c\n",v1,v2);
i=LocateVex(G,v1);
j=LocateVex(G,v2);
G->arcs[i][j]=1;
}
printf("OK");
}
int main(int argc, char *argv[]) {
AMGraph G;
CreateUDN(&G);
return 0;
}
运行结果及详细报错内容
help me@qzjhjxj