#include<stdio.h>#include<malloc.h>intmain(){?int*a;intb,n,c,g,h,k,d=0;inti,j;intm=0;?printf("选择类型前的序号:\n1,无向图\n2,有向图\n");?scanf("%d",&b);printf("请输入顶点个数:");scanf("%d",&n);a=(int*)malloc(sizeof(int)*(n*n));printf("输入矩阵中的数:\n");?for(i=0;i<n;i++) for(j=0;j<n;j++) {printf("第%d行第%d列=",i+1,j+1); scanf("%d",&a[m]); m++; }; m=0;for(i=0;i<n;i++){for(j=0;j<n;j++){?printf("%d",a[m]);?m++;};printf("\n");};c=0;if(b==1){for(i=0;i<n;i++){for(j=0;j<n;j++){?m=i*n+j;c=c+a[m];};if(c%2==0)d++;c=0;};if(d==n)printf("该无向图为欧拉图\n");elseprintf("该无向图不是欧拉图\n");};d=0;if(b==2){for(j=0;j<n;j++){?k=h=0;for(g=0;g<n;g++){?m=j*n+g;h=h+a[m];m=g*n+j;k=k+a[m];};if(h==k)d++;};if(d==n)printf("该有向图为欧拉图\n");elseprintf("该有向图不是欧拉图\n");};free(a);return0;};