本帖最後由 李泳霖 於 2024-1-16 16:32 編輯
- int[] scores = { 50, 60, 70, 30, 20 };
- System.Console.WriteLine(scores[0]);
- System.Console.WriteLine(scores[1]);
- System.Console.WriteLine(scores[2]);
- System.Console.WriteLine(scores[3]);
- System.Console.WriteLine(scores[4]);
- scores[0] = 10;
- System.Console.WriteLine(scores[0]);
- //創建陣列當下不知道要存放甚麼?
- //創建一個空陣列
- string[] n = new string[3];
- n[0] = "Leo";
- n[1] = "Mary";
- n[2] = "Kevin";
- System.Console.WriteLine(n[0]);
- System.Console.WriteLine(n[1]);
- System.Console.WriteLine(n[2]);
複製代碼 |