图的邻接表
#include"stdio.h"#include"malloc.h"
#define MAXVER 10
typedef char ElemType;
typedef struct node
{ int num;
struct node *next;
}slink;
typedef struct
{ struct
{ ElemType vertex;
slink *first;
}ve[MAXVER];
int vex,edge,tag;
}adjlist;
//邻接表的建立
void cregraph(adjlist *G,int n,int m)
{ int i,e=0;slink *p,*q,*s;char x,y;
G->vex=n;G->tag=m;
for(i=0;i<n;i++)
{ G->ve[i].vertex=i+'A';G->ve[i].first=NULL;}
printf("Input edges(x-->y):");
scanf("%c%c",&x,&y);
printf("%c%c",x,y);
}
void main()
{ adjlist G;
int n,m;
scanf("%d%d",&n,&m);
cregraph(&G,n,m);
}
为何输入XY却只能出来Y啊