我試圖運行一個3d數組,但代碼只是在Windows中崩潰時,我運行它,這裏是我的代碼;C++ 3d arrays
#include <iostream>
using namespace std;
int main(){
int myArray[10][10][10];
for (int i = 0; i <= 9; ++i){
for (int t = 0; t <=9; ++t){
for (int x = 0; x <= 9; ++t){
myArray[i][t][x] = i+t+x;
}
}
}
for (int i = 0; i <= 9; ++i){
for (int t = 0; t <=9; ++t){
for (int x = 0; x <= 9; ++t){
cout << myArray[i][t][x] << endl;
}
}
}
system("pause");
}
有人可以把我速戰速決/解釋
選擇這個答案,並用它做。 – Tim 2008-12-11 18:57:10
通過在第一個嵌套循環中包含「cout <<」行,您也可以找到同樣的結果。 – BIBD 2008-12-11 18:59:06