using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp3
{
class Program
{
static void Main(string[] args)
{
try
{
int[] array;
int length = Convert.ToInt32(8);
array = new int[length];
for (int i = 0; i < length; i++)
{
Console.WriteLine("要求用户在控制台动态输入数组的8个元素");
Console.Write("请用数字输入数组的第{0}个的值:", i);
array[i] = Convert.ToInt32(Console.ReadLine());
}
Array.Sort(array);
foreach (int i in array)
Console.WriteLine(i);
Console.WriteLine("\n");
Array.Reverse(array,0,8);
Array.Reverse(array,0, 5);
Array.Reverse(array, 5,3);
for(int i = 0;i< array.Length;i++)
{
Console.WriteLine(array[i]);
}
}
catch
{
Console.WriteLine("你输入的不是数字!");
}
Console.ReadLine();
}
}
}