-1

有人能告诉我为什么我的第二列不是拳头的正方形吗?这是我所拥有的:

const int NUM_ROWS = 10;
const int NUM_COLS = 2;

int[,] randint = new int [NUM_ROWS,NUM_COLS];
Random randNum = new Random();

for (int row = 0; row < randint.GetLength(0); row++)
{
    randint[row,0] = randNum.Next(1,100);
    randint[row,1] = randint[row,0]*randint[row,0];

Console.Write(string.Format("{0,5:d} {0,5:d}\n", randint[row,0], randint[row,1]));
4

1 回答 1

1

这是。您只是将第一个数字打印到控制台。你的字符串格式应该是"{0,5:d} {1,5:d}\n"

于 2015-03-28T02:32:48.823 回答