[求助] 为何在同一数组中交换元素不行??
using System;
class D4_3_1
{
public static void Main()
{
int[] a = new int[10];
int i, j=0;
Random randObj = new Random();
for (i = 0; i < 10; i++)
a[i] = randObj.Next(10,100);
for (i = 0; i < 10; i++)
Console.Write(a[i] + " ");
Console.WriteLine();
for (i = 0; i < 10; i++)
{
j = a[i];
a[i] = a[9 - i];
a[9 - i] = j;
}
for (i = 0; i < 10; i++)
Console.Write(a[i] + " ");
Console.WriteLine();
}
}
为何在同一数组中交换元素不行??