64,642
社区成员
发帖
与我相关
我的任务
分享
#include <iostream.h>
void main()
{
int a[3][3];
for ( int i = 0, temp = 1; i <= 2; i++)
{
for ( int j = 0; j <= 2; j++,temp++)
{
a[i][j] = temp;
cout << a[i][j] << " " ;
}
cout << endl;
}
cout << " After transform :" << endl;
for ( j = 0; j <= 2; j++) //这里不再次定义j时,会出错~~
{
for ( i =0 ; i <= 2; i++)
{
cout << a[i][j] <<" ";
}
cout << endl;
}
}