相关代码 |
|
#include void transpose(int a[][3],int b[][3]) { int m,n,i,j,*x,*y; b[0][1]=a[0][0]; n=b[0][0]=a[0][1]; m=b[0][2]=a[0][2]; if (m return; y=new int[n+1]; x=y+1; for (i=0;i x[i]=0; for (i=1;i x[a[i][1]]++; y[0]=1; for (i=1;i y[i]=y[i-1]+x[i-1]; for (i=1;i { j=y[a[i][1]]++; b[j][0]=a[i][1]; b[j][1]=a[i][0]; b[j][2]=a[i][2]; } delete []y; } void main() { int a[][3]={{5,4,7},{0,0,1},{1,1,5},{2,2,7},{2,3,2},{3,0,6},{4,1,3},{4,3,8}}; int b[100][3]; transpose(a,b); for (int i=1;i cout }
相关资源 |
|