有人能告诉我为什么我的第二列不是拳头的方格吗?这就是我所拥有的:
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]));
答案 0 :(得分:1)
是的。您只是将第一个数字打印到控制台。您的字符串格式应为"{0,5:d} {1,5:d}\n"