说,我有数组矩阵matrixA这是2×3和填充为0。如何设置我的循环,使值将被读入,但如果用户只输入3个值,在矩阵matrixA其余3为0?将值读入C++的二维数组?
编辑:
const int Q = 2;
const int S = 3;
int matrixA[Q][S] = {0};
for(int i = 0; i < Q; i++){
for(int j = 0; j < S; j++){
cin >> matA[i][j];
}
}
你知道如何访问它们?并显示您当前的代码。 – herohuyongtao
用我的代码编辑。 –
你的循环对我来说很好。 – herohuyongtao