不知道发生了什么,看图
c4droid吧
全部回复
仅看楼主
level 9
逝落_ 楼主
2016年09月26日 15点09分 1
level 9
逝落_ 楼主
代码
2016年09月26日 15点09分 2
把倒数两行注释删掉就报错
2016年09月26日 15点09分
level 9
逝落_ 楼主
#include<iostream>
using namespace std;
int a,b;
int c,d;
class unit{
public:
int x;
int y;
};
int main()
{
c=2;
d=3;
unit unit[c][d];
for (a=1;a<3;a++)
{
for (b=1;b<4;b++)
{
unit[a][b].x=a;
cout<<unit[a][b].x;
unit[a][b].y=b;
}
}
//cout<<unit[1][1].x<<"\n";
//cout<<unit[1][1].y;
}
2016年09月26日 15点09分 3
level 12
首先,数组溢出了,其次,unit可能是保留字
2016年09月27日 01点09分 4
楼下
2016年09月27日 14点09分
level 9
逝落_ 楼主
unit没有变色,不知道是不是保留字,二维数组我申请的空间应该是够的
2016年09月27日 14点09分 5
1