?? ch4_3.txt
字號:
void crt_linkedmat(JD *rh[],JD *ch[],int *hs,int *ls)
{ int m,n,i,r,c,v;
JD *p,*q,*s;
printf("Input m,n:");
scanf("%d,%d",&m,&n);
for(i=0;i<m;i++) rh[i]=NULL;
for(i=0;i<n;i++) ch[i]=NULL;
*hs=m; *ls=n;
for(;;)
{ printf(Input r,c,v:");
scanf("%d,%d,%d",&r,&c,&v);
if(r==0 || c==0) break;
if((r>m)||(c>n)) continue;
s=(JD *)malloc(sizeof(JD));
s->row=r; s->col=c; s->val=v;
s->right=s->down=NULL;
q=NULL; p=rh[r-1];
while((p!=NULL)&&(c>p->col))
{ q=p; p=p->right; }
if(p==NULL)
{ if(q==NULL) rh[r-1]=s;
else q->right=s;
}
else if(c==p->col)
{ p->val=v; free(s); continue; }
else
{ if(q==NULL)
{ rh[r-1]=s; s->right=p; }
else
{ s->right=p; q->right=s; }
}
q=NULL; p=ch[r-1];
while((p!=NULL)&&(r>p->row))
{ q=p; p=p->down; }
if(p==NULL)
{ if(q==NULL) ch[c-1]=s;
else q->down=s;
}
else
{ if(q==NULL)
{ ch[c-1]=s; s->down=p; }
else
{ s->down=p; q->down=s; }
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -