标签:temp OLE key nbsp 顺序 for 反转 mes line
//将一个字符串数组的元素的顺序进行反转。
//{“A”,“B”,”C”,"D","E","F"} {“F”,”E”,”D”,“C”,“B”,”A”}。第i个和第length-i-1个进行交换。
//i Length-1-0
//i+1 Leng-1-1
//i+2 Leng-1-2
string[] names = { "a", "b", "c", "d", "e", "f", "g" };
for (int i = 0; i < names.Length / 2; i++)
{
string temp = names[i];
names[i] = names[names.Length - 1 - i];
names[names.Length - 1 - i] = temp;
}
for (int i = 0; i < names.Length; i++)
{
Console.WriteLine(names[i]);
}
Console.ReadKey();
标签:temp OLE key nbsp 顺序 for 反转 mes line
原文地址:https://www.cnblogs.com/momj/p/14273747.html