我試圖讓我的「遊戲」出現在這段代碼的每一行但它一直出現在年底前,我無法工作,如何解決我的環使它會在正確的時間創建一個新行。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