不懂得array
// Create a string array of size 5:
string[] employeeNames = new string[5];
System.Console.WriteLine("Enter five employee names:");
for (int i = 0; i < employeeNames.Length; i++)
{
employeeNames[i] = System.Console.ReadLine();
}
Console.WriteLine();
// Print the array in original order:
foreach (string employeeName in employeeNames)
{
System.Console.Write("{0} ", employeeName);
}
Console.WriteLine();
System.Array.Reverse(employeeNames);
// Print the array in reverse order:
foreach (string employeeName in employeeNames)
{
System.Console.Write("{0} ", employeeName);
}
Console.WriteLine();
System.Array.Sort(employeeNames);
// Print the array in sorted order:
foreach (string employeeName in employeeNames)
{
System.Console.Write("{0} ", employeeName);
}
Console.Read();
结果: