C++输出N*N矩阵,其中一些语句难以看懂,各位有空帮帮忙
#include<iostream.h>#define N 15
int s[N][N];
void main()
{
int k = 0, m = 0, j = 0;
int a = 1;
for( ; k < (N+1)/2; k++ )
{
while( j < N-k ) s[m][j++] = a++; m++; j--;
while( m < N-k ) s[m++][j] = a++; m--; j--;
while( j > k-1 ) s[m][j--] = a++; m--; j++;
while( m > k ) s[m--][j] = a++; m++; j++;
}
for( m = 0; m < N; m++ )
{
for( j = 0; j < N; j++ )
cout << s[m][j] << ' ';
cout << endl;
}
}
for循环中的语句看不懂,求个解释