int a[4][4];
int b[4][4];
int k=1;
int i,j;
for(i=0; i<4; i++)
{
for(j=0; j<4; j++)
{
a[i][j] = k++;
printf("%8d ", a[i][j]);
//NSLog(@"%d",a[i][j]);
}
printf("\n");
//NSLog(@"\n");
}
printf("\nresult:\n");
//NSLog(@"\nresust:\n");
for(i=0; i<4; i++)
{
for(j=0; j<4; j++)
{
b[j][3-i] = a[i][j]; //顺时针 改成 b[3-j][i] = a[i][j] 为逆时针
}
}
for(j=0; j<4; j++)
{
for(i=0; i<4; i++)
{
printf("%8d ", b[j][i]);
//NSLog(@"%d",b[j][i]);
}
printf("\n");
//NSLog(@"\n");
}
int b[4][4];
int k=1;
int i,j;
for(i=0; i<4; i++)
{
for(j=0; j<4; j++)
{
a[i][j] = k++;
printf("%8d ", a[i][j]);
//NSLog(@"%d",a[i][j]);
}
printf("\n");
//NSLog(@"\n");
}
printf("\nresult:\n");
//NSLog(@"\nresust:\n");
for(i=0; i<4; i++)
{
for(j=0; j<4; j++)
{
b[j][3-i] = a[i][j]; //顺时针 改成 b[3-j][i] = a[i][j] 为逆时针
}
}
for(j=0; j<4; j++)
{
for(i=0; i<4; i++)
{
printf("%8d ", b[j][i]);
//NSLog(@"%d",b[j][i]);
}
printf("\n");
//NSLog(@"\n");
}