为什么j要再定义一次?求解~~
程序代码:
#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; } }
不解捏~~~哪位大大解答下?