示例#1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            Loader read = new Loader();

            BigText.Clear();
            read.filePath = textinput.Text.ToString();
            if (Number.Checked && !(Strings.Checked))
            {
                numbers = new List <int>();
                numbers.Clear();
                read.ReadDataInt(numbers);
                int nn = numbers.Count;
                if (numbers.Count > 1000)
                {
                    nn = 1000;
                }
                for (int i = 0; i < nn; i++)
                {
                    BigText.Text += numbers[i].ToString() + Environment.NewLine;
                }
            }


            if (Strings.Checked && !(Number.Checked))
            {
                strings = new List <string>();
                strings.Clear();
                read.ReadDataText(strings);
                int nn = strings.Count;
                if (strings.Count > 1000)
                {
                    nn = 1000;
                }
                for (int i = 0; i < nn; i++)
                {
                    BigText.Text += strings[i] + Environment.NewLine;
                }
            }


            if (!(Number.Checked) && !(Strings.Checked))
            {
                MessageBox.Show("Выберите тип данных!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            if (Number.Checked && Strings.Checked)
            {
                MessageBox.Show("Выберите только одну из типов данных!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#2
0
        private void button1_Click(object sender, EventArgs e)
        {
            perestanovkapiramida = 0;

            if (BigText.Text == "")
            {
                MessageBox.Show("Загрузите данные!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                BigText.Clear();
                if (Number.Checked && !(Strings.Checked))
                {
                    if (lineagevstavki.Checked)
                    {
                        Stopwatch time = new Stopwatch();
                        time.Start();
                        InsertionSort(numbers);
                        time.Stop();
                        Boxtime.Text = time.ElapsedTicks.ToString();
                    }
                    if (binstavki.Checked)
                    {
                        Stopwatch time = new Stopwatch();
                        time.Start();
                        SortBinInsert(numbers);
                        time.Stop();
                        Boxtime.Text = time.ElapsedTicks.ToString();
                    }
                    if (quicksort.Checked)
                    {
                        Stopwatch time = new Stopwatch();
                        time.Start();
                        QuickSort(numbers, 0, numbers.Count - 1);
                        time.Stop();
                        Boxtime.Text = time.ElapsedTicks.ToString();
                    }
                    if (shell.Checked)
                    {
                        Stopwatch time = new Stopwatch();
                        time.Start();
                        SortBinInsert(numbers);
                        time.Stop();
                        Boxtime.Text = time.ElapsedTicks.ToString();
                    }
                    int nn = numbers.Count;
                    if (numbers.Count > 1000)
                    {
                        nn = 1000;
                    }
                    for (int i = 0; i < nn; i++)
                    {
                        BigText.Text += numbers[i].ToString() + Environment.NewLine;
                    }
                }

                if (Strings.Checked && !(Number.Checked))
                {
                    if (lineagevstavki.Checked)
                    {
                        Stopwatch time = new Stopwatch();
                        time.Start();
                        InsertionSort(strings);
                        time.Stop();
                        Boxtime.Text = time.ElapsedTicks.ToString();
                    }
                    if (binstavki.Checked)
                    {
                        Stopwatch time = new Stopwatch();
                        time.Start();
                        SortBinInsert(strings);
                        time.Stop();
                        Boxtime.Text = time.ElapsedTicks.ToString();
                    }
                    if (quicksort.Checked)
                    {
                        Stopwatch time = new Stopwatch();
                        time.Start();
                        QuickSort(strings, 0, strings.Count - 1);
                        time.Stop();
                        Boxtime.Text = time.ElapsedTicks.ToString();
                    }
                    if (shell.Checked)
                    {
                        Stopwatch time = new Stopwatch();
                        time.Start();
                        SortBinInsert(strings);
                        time.Stop();
                        Boxtime.Text = time.ElapsedTicks.ToString();
                    }
                    int nn = strings.Count;
                    if (strings.Count > 1000)
                    {
                        nn = 1000;
                    }
                    for (int i = 0; i < nn; i++)
                    {
                        BigText.Text += strings[i] + Environment.NewLine;
                    }
                }
            }
        }
示例#3
0
文件: BigText.cs 项目: ytkimirti/ld46
 private void Awake()
 {
     main = this;
 }