using System;
namespace Example39
{
///
/// Summary description for Class1.
///
class Class1
{
public static void PrintArray(string s, int[] a)
{
Console.Write(s);
for (int i = 0; i < a.Length; i++)
{
Console.Write(a[i] + " ");
}
Console.WriteLine();
}
///
/// The main entry point for the application.
///
[STAThread]
static void Main(string[] args)
{
Random r = new Random();
int[]x = new int[10];
for (int i = 0; i < x.Length; i++)
{
x[i] = r.Next(0, 100);
}
PrintArray("x= ", x);
// Reverse x
Array.Reverse(x);
PrintArray("xr=", x);
// Sort x
Array.Sort(x);
PrintArray("xs=", x);
// Copy x to y
int[]y = new int[x.Length];
Array.Copy(x, y, x.Length);
PrintArray("y= ", y);
}
}
}