那个十字链表怎么建立?
typedef int Etype; typedef struct OLnode {int i,j; Etype e; struct OLnode *right,*down; }OLnode; typedef struct {OLnode *rh[5],*ch[5]; int mu,nu,tu; }Crosslist;void creatMatrix(Crosslist *M);void out_M(Crosslist M);Crosslist ma; int z;void main(){ creatMatrix(&ma); out_M(ma);}void out_M(Crosslist ...全部
typedef int Etype; typedef struct OLnode {int i,j; Etype e; struct OLnode *right,*down; }OLnode; typedef struct {OLnode *rh[5],*ch[5]; int mu,nu,tu; }Crosslist;void creatMatrix(Crosslist *M);void out_M(Crosslist M);Crosslist ma; int z;void main(){ creatMatrix(&ma); out_M(ma);}void out_M(Crosslist M){int i;OLnode *p; char ch; printf("\n m=%d t=%d\n",M。
mu,M。nu,M。tu); for(i=1; ii,p->j,p->e);p=p->right; } } printf("\n"); } printf("\n 打回车键,返回。
");ch=getchar();}void creatMatrix(Crosslist *M) { int m,n,t,row,col,i,j; Etype va; OLnode *p,*q,*s; printf("\n m,n,t=?"); scanf("%d,%d,%d",&m,&n,&t); for(i=1; irh[i]=NULL; for(j=1; jch[j]=NULL; M->mu=m; M->nu=n; M->tu=t; for(i=1;itu;i++) { printf("\n i,j,e=?"); scanf("%d,%d,%d",&row,&col,&va); p=(OLnode*)malloc(sizeof(OLnode));p->i=row; p->j=col; p->e=va;q=M->rh[row]; s=q;while(q!=NULL && q->j right;}p->right=q; if(q==M->rh[row])M->rh[row]=p;else s->right=p; q=M->ch[col]; while(q && q->i down;}p->down=q; if(q==M->ch[col]) M->ch[col]=p; else s->down=p; }}。收起