日期:2014-05-18 浏览次数:20821 次
int pos = 0; int[] array = new int[5]; Console.WriteLine("please input 5 numbers:"); while (pos < 5) { string[] s = Console.ReadLine().Split(' '); for (int i = pos; i < pos + s.GetLength(0) && pos < 5; i++, pos++) array[i] = Convert.ToInt32(s[i - pos]); } Console.Write("\r\nyour entered: " + array[0]); for (int i = 1; i < 5; i++) { Console.Write(", " + array[i]; } Console.WriteLine();