Пример #1
0
 private void task2Btn_Click(object sender, EventArgs e)
 {
     if (LabTask.CheckInput(Controls["elemsNumberInput"].Text))
     {
         int n = Convert.ToInt32(Controls["elemsNumberInput"].Text);
         if (n > 2)
         {
             IncorrectInput("");
             double[,] array = LabTask.CreateArray(n, n);
             double[] result    = LabTask.FindSequence(array);
             string   resultStr = "";
             for (int i = 0; i < result.Length; i++)
             {
                 resultStr += Convert.ToString(result[i]);
             }
             Controls["task2Lbl"].Text = resultStr;
             ArrayOutput(array);
         }
         else
         {
             IncorrectInput("Please, input n > 2.");
         }
     }
     else
     {
         IncorrectInput("Incorrect input!");
     }
 }
Пример #2
0
 private void task1CBtn_Click(object sender, EventArgs e)
 {
     if (LabTask.CheckInput(Controls["elemsNumberInput"].Text))
     {
         IncorrectInput("");
         int      n      = Convert.ToInt32(Controls["elemsNumberInput"].Text);
         double[] array  = LabTask.CreateArray(n);
         double   result = LabTask.FindMultOfMinMax(array);
         Controls["task1CLbl"].Text = Convert.ToString(result);
         ArrayOutput(array);
     }
     else
     {
         IncorrectInput("Incorrect input!");
     }
 }
Пример #3
0
 private void task1BBtn_Click(object sender, EventArgs e)
 {
     if (LabTask.CheckInput(Controls["elemsNumberInput"].Text))
     {
         IncorrectInput("");
         int      n      = Convert.ToInt32(Controls["elemsNumberInput"].Text);
         double[] array  = LabTask.CreateArray(n);
         double   result = LabTask.FindSumOfElems3(array);
         if (array.Length >= 4)
         {
             Controls["task1BLbl"].Text = Convert.ToString(result);
             ArrayOutput(array);
         }
         else
         {
             IncorrectInput("Array doesn't contain any elements with index is a multiple of 3.");
         }
     }
     else
     {
         IncorrectInput("Incorrect input!");
     }
 }
Пример #4
0
 private void task1ABtn_Click(object sender, EventArgs e)
 {
     if (LabTask.CheckInput(Controls["elemsNumberInput"].Text))
     {
         IncorrectInput("");
         int      n      = Convert.ToInt32(Controls["elemsNumberInput"].Text);
         double[] array  = LabTask.CreateArray(n);
         double   result = LabTask.FindSumOfNegative(array);
         if (result != 0)
         {
             Controls["task1ALbl"].Text = Convert.ToString(result);
             ArrayOutput(array);
         }
         else
         {
             IncorrectInput("Array doesn't contain any negative elements.");
         }
     }
     else
     {
         IncorrectInput("Incorrect input!");
     }
 }