回覆列表
  • 1 # lanfengz1

    //一維陣列

    int[] iArray = new int[] { 1, 2, 3, 45, 6 };

    foreach (int i in iArray)

    Console.Write(i.ToString() + ",");

    Console.WriteLine("\n\n");

    //2級陣列

    int[,] i2Array = new int[,] { { 1, 2 }, { 3, 4 } };

    foreach (int i1 in i2Array)

    {

    Console.Write(i1.ToString() + ",");

    }

    Console.WriteLine("\n\n");

    //交錯陣列

    int[][] CrossArray = new int[3][] { new int[]{ 1, 2 }, new int[]{ 3, 4, 5 }, new int[]{ 6, 7, 8, 9 } };

    foreach (int[] c in CrossArray)

    {

    foreach (int i in c)

    Console.Write(i.ToString() + ",");

    Console.Write("\n");

    }

  • 中秋節和大豐收的關聯?
  • 三千大世界指什麼?