static voud Main()
{
Console.WriteLine("輸入一個數字來確定陣列的大小");
int myInt = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("輸入一串數字來作為陣列的元素 :");
string myString = Console.ReadLine();
myString = myString.Trim();//去掉輸入時首尾的空格
char[] myCharArray1 = new char[myInt];
char[] myCharArray2 = myString.ToCharArray();
myCharArray1 = myCharArray2;
Console.WriteLine("陣列中元素有:");
foreach (char myChar in myCharArray1)
Console.Write("{0} ",myChar );
}
Console.ReadKey();
static voud Main()
{
Console.WriteLine("輸入一個數字來確定陣列的大小");
int myInt = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("輸入一串數字來作為陣列的元素 :");
string myString = Console.ReadLine();
myString = myString.Trim();//去掉輸入時首尾的空格
char[] myCharArray1 = new char[myInt];
char[] myCharArray2 = myString.ToCharArray();
myCharArray1 = myCharArray2;
Console.WriteLine("陣列中元素有:");
foreach (char myChar in myCharArray1)
{
Console.Write("{0} ",myChar );
}
Console.ReadKey();
}