类型无效 'int[int]' 对于数组索引
此代码发出标题中给出的编译错误,是否有人可以告诉我更改什么?
先感谢您
</iostream>
#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; ++x/{
for /int y = 0; y <= 9; ++y/{
myArray[i][t][x][y] = i+t+x+y; //This will give each element a value
}
}
}
}
for /int i = 0; i <= 9; ++i/{
for /int t = 0; t <=9; ++t/{
for /int x = 0; x <= 9; ++x/{
for /int y = 0; y <= 9; ++y/{
cout << myArray[i][t][x][y] << endl;
}
}
}
}
system/"pause"/;
}
先感谢您
</iostream>
没有找到相关结果
已邀请:
6 个回复
奔跑吧少年
赞同来自:
四次
. 可能您必须为您的阵列添加另一个维度。 还要考虑类型容器
http://www.boost.org/doc/libs/ ... .html
, 虽然目前它可能会在你的头上。
冰洋
赞同来自:
八刀丁二
赞同来自:
必须是
小明明
赞同来自:
你只需要 3 循环而不是 4, 或者
石油百科
赞同来自:
莫问
赞同来自:
例子: