下面的C++不能实现如下输出,但如果将L1标记的 cout << 0 行移动 if 块外面,或者说移动到 L2 标记 行,则可以。( )
请输入矩阵大小n: 9
100000000
020000000
003000000
000400000
000050000
000006000
000000700
000000080
000000009
int n, i, j;
cout << "请输入矩阵大小n: ";
cin >> n;
for (i = 0; i < n; i++){
for (j = 0; j < n; j++){
if (i == j){
cout << i + 1;
continue;
cout << 0; // L1
}
// L2
}
printf("\n");
}
正确答案:正确(√)