int num = 0;
cin>>num;
int **ip = new int* [num];
for(int i = 0; i != num;++i)
ip[i] = new int [num];
//----------------------------------赋值
for(int i = 0; i != num; ++i)
for(int j = 0; j!= num; ++j)
ip[i][j] = i;
//----------------------------------输出
for(int i = 0; i != num; ++i)
for(int j = 0; j!= 4; ++j)
cout<<ip[i][j]<<endl;
动态分配二维数组 c++
最新推荐文章于 2023-08-18 21:41:23 发布