-2
我想這轉化爲循環到做while循環,並保持一個7 x 7
矩陣轉換爲用於循環做while循環
for循環輸出數量7 x 7
:
for (int height = 0; height < 7; height++){
cout << numberMatrix[height][digitOne] << " ";
cout << numberMatrix[height][digitTwo] << " ";
cout << numberMatrix[height][digitThree] << " ";
cout << endl;
}
右輸出:
這是我的代碼轉換後,但它不出來的權利。
for循環輸出數量7 x 7
:
int height = 0;
while (height < 7) {
cout << numberMatrix[height][digitOne] << " ";
cout << numberMatrix[height][digitTwo] << " ";
cout << numberMatrix[height][digitThree] << " ";
height++;
}
}
錯誤輸出:
'COUT << ENDL;'你忘記在while循環 – sinsuren
請不要張貼圖片,複製/粘貼文本輸出 – Garf365
到兩個代碼段這條線是等價的(除了缺少'cout << endl') – bolov