我试图让我的“游戏”出现在这段代码的每一行但它一直出现在年底前,我无法工作,如何解决我的环使它会在正确的时间创建一个新行。For循环使用有序阵列格式错误
static void Main() {
int[,] lottoNumbers ={
{ 4, 7, 19, 23, 28, 36},
{14, 18, 26, 34, 38, 45},
{ 8, 10,11, 19, 28, 30},
{15, 17, 19, 24, 43, 44},
{10, 27, 29, 30, 32, 41},
{ 9, 13, 26, 32, 37, 43},
{ 1, 3, 25, 27, 35, 41},
{ 7, 9, 17, 26, 28, 44},
{17, 18, 20, 28, 33, 38}
};
int[] drawNumbers = new int[] { 44, 9, 17, 43, 26, 7, 28, 19 };
PrintLottoNumbers(lottoNumbers);
ExitProgram();
}//end Main
static void PrintLottoNumbers(int[,] lottoN)
{
for (int x = 0; x < lottoN.GetLength(0); x++) {
for (int y = 0; y < lottoN.GetLength(1); y++) {
if(y < 1 && x > 0)
{
Console.WriteLine("Game" + lottoN[x, y] + " ");
}else {
Console.Write($"{lottoN[x, y],2}" + " ");
//Console.Write(lottoN[x, y] + " ");
}
}
}
}//Print Function For Lotto Numbers
完美!非常感谢你们! – BobFisher3