using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ch5_9
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
        }

        private void button1_Click(object sender, EventArgs e)
        {
            label1.Text = "";
            Array ar = new int[4] { 16, 11, 17, 13 };
            label1.Text += " Initial array      : ";
            for (int i = 0; i < ar.Length; i++)
                label1.Text += (ar.GetValue(i)).ToString() + "   ";
            Array.Sort(ar);
            label1.Text += "\n Sorted array    :";
            foreach (int num in ar)
                label1.Text += num.ToString() + "     ";
            Array.Reverse(ar);
            label1.Text += "\n Reverse         : ";
            for (int i = 0; i < ar.Length; i++)
                label1.Text += (ar.GetValue(i)).ToString() + "     ";
            label1.Text += "\n Set element : ";
            ar.SetValue(1000, 3);
            label1.Text += "\n New values    : ";
            for (int i = 0; i < ar.Length; i++)
                label1.Text += (ar.GetValue(i)).ToString() + "     ";
        }
    }
}
