Esempio n. 1
0
        private void buttonLab07Execute_Click(object sender, EventArgs e)
        {
            dataGridViewLab07.ClearSelection();
            int rowsCount = dataGridViewLab07.RowCount;

            if (radioButtonLab07Manual.Checked)
            {
                DataGridViewToArray2d(dataGridViewLab07, LabMethods.array2d);
            }
            int rowIndex = LabMethods.Lab07(LabMethods.array2d);

            if (rowIndex > -1)
            {
                labelLab07Answer.Text = $"Номер столбца с максимальным\n" +
                                        $"количеством нулей: {rowIndex + 1}";
                for (int i = 0; i < rowsCount; i++)
                {
                    dataGridViewLab07.Rows[i].Cells[rowIndex].Value =
                        LabMethods.array2d[i, rowIndex].ToString();
                }
                for (int i = 0; i < dataGridViewLab07.RowCount; i++)
                {
                    dataGridViewLab07.Rows[i].Cells[rowIndex].Selected = true;
                }
            }
            else
            {
                labelLab07Answer.Text = $"Нули в матрице отстутсвуют";
            }
        }
Esempio n. 2
0
 private void dataGridViewLab05_Reindexate()
 {
     for (int i = 0; i < dataGridViewLab05.RowCount; i++)
     {
         dataGridViewLab05.Rows[i].Cells[0].Value = (i + 1).ToString();
         dataGridViewLab05.Rows[i].Cells[2].Value = LabMethods.Factorial(i + 1);
     }
 }
Esempio n. 3
0
        //
        // Lab10
        //

        private void buttonLab10Execute_Click(object sender, System.EventArgs e)
        {
            richTextBoxLab10Out.Clear();
            string[] lines = textBoxLab10In.Text.Split("\r\n");
            lines = LabMethods.Lab10(lines);
            foreach (var line in lines)
            {
                richTextBoxLab10Out.AppendText(line + '\n');
            }
        }
Esempio n. 4
0
        private void buttonLab07AutoFill_Click(object sender, EventArgs e)
        {
            int rowsCount    = Convert.ToInt32(numericUpDownLab07AutoRows.Value);
            int columnsCount = Convert.ToInt32(numericUpDownLab07AutoColumns.Value);

            LabMethods.array2d = LabMethods.GetIntArray2(rowsCount, columnsCount, -10, 10);
            Array2dToDataGridView(LabMethods.array2d, dataGridViewLab07);
            dataGridViewLab07.AutoResizeColumns();
            dataGridViewLab07.ClearSelection();
        }
Esempio n. 5
0
 private void dataGridViewLab06_Reindexate()
 {
     for (int i = 0; i < dataGridViewLab06.RowCount; i++)
     {
         dataGridViewLab06.Rows[i].Cells[0].Value = (i + 1).ToString();
         dataGridViewLab06.Rows[i].Cells[2].Value =
             LabMethods.DigitsCount(
                 Convert.ToInt32(dataGridViewLab06.Rows[i].Cells[1].Value)
                 ).ToString();
     }
 }
Esempio n. 6
0
        private void buttonLab06Execute_Click(object sender, EventArgs e)
        {
            dataGridViewLab06_Reindexate();
            long[] array = new long[dataGridViewLab06.RowCount];
            for (int i = 0; i < array.Length; i++)
            {
                array[i] = Convert.ToInt64(dataGridViewLab06.Rows[i].Cells[1].Value);
            }
            int index = LabMethods.Lab06(array);

            dataGridViewLab06.ClearSelection();
            dataGridViewLab06.Rows[index].Selected = true;
        }
Esempio n. 7
0
        //
        // Lab06
        //

        private void buttonLab06FillArray_Click(object sender, EventArgs e)
        {
            int rowsCount = Convert.ToInt32(numericUpDownLab06RowsAuto.Value);

            int[] array = LabMethods.GetIntArray(rowsCount, 0, 100000);
            dataGridViewLab06.RowCount = array.Length;
            for (int i = 0; i < array.Length; i++)
            {
                dataGridViewLab06.Rows[i].Cells[0].Value = (i + 1).ToString();
                dataGridViewLab06.Rows[i].Cells[1].Value = array[i].ToString();
                dataGridViewLab06.Rows[i].Cells[2].Value = LabMethods.DigitsCount(array[i]).ToString();
            }
            dataGridViewLab06.ClearSelection();
        }
Esempio n. 8
0
        //
        // Lab05
        //

        private void buttonLab05FillArray_Click(object sender, EventArgs e)
        {
            int rowsCount = Convert.ToInt32(numericUpDownLab05RowsAuto.Value);

            double[] array = LabMethods.GetDoubleArray(rowsCount, 20);
            dataGridViewLab05.RowCount = array.Length;
            for (int i = 0; i < array.Length; i++)
            {
                dataGridViewLab05.Rows[i].Cells[0].Value = (i + 1).ToString();
                dataGridViewLab05.Rows[i].Cells[1].Value = array[i].ToString();
                dataGridViewLab05.Rows[i].Cells[2].Value = LabMethods.Factorial(i).ToString();
            }
            textBoxLab05Result.Clear();
            dataGridViewLab05.ClearSelection();
            LabMethods.Lab05CheckedIndices = new bool[0];
        }
Esempio n. 9
0
        private void buttonLab05Execute_Click(object sender, EventArgs e)
        {
            double[] array = new double[dataGridViewLab05.RowCount];
            for (int i = 0; i < array.Length; i++)
            {
                array[i] = Convert.ToDouble(dataGridViewLab05.Rows[i].Cells[1].Value);
            }
            double inverseProduct = 1;

            if (LabMethods.Lab05(array, out inverseProduct))
            {
                textBoxLab05Result.Text = inverseProduct.ToString();
            }
            else
            {
                textBoxLab05Result.Text = "Нет удовлетворяющих условию элементов";
            }
            dataGridViewLab05.ClearSelection();
            checkBoxLab05RowsHighlight_CheckedChanged(sender, e);
        }
Esempio n. 10
0
        //
        // Lab03
        //

        private void buttonLab03Execute_Click(object sender, System.EventArgs e)
        {
            double.TryParse(textBoxLab03x.Text, out double x);
            double.TryParse(textBoxLab03z.Text, out double z);
            textBoxLab03Answer.Text = LabMethods.Lab03(x, z).ToString();
        }