62,040
社区成员
发帖
与我相关
我的任务
分享
int row = 2, col = 3;
string[,] array=new string[10,10];
for (int i = 0; i < 10; i++)
{
for (int j = 0; j < 10; j++)
{
array[i, j] = "1";
}
}
int length1 = array.GetLength(0);
int length2 = array.GetLength(1);
int startRow = length1 / 2 - (row / 2 - 1) - 1 ;
int startCol = length2 / 2 - (col / 2 - 1) - 1;
for (int i = startRow; i < startRow + row; i++)
{
for (int j = startCol; j < startCol + col; j++)
{
array[i,j] = "";
}
}