This commit is contained in:
Anastasia Yazykova 2024-06-29 03:55:38 +04:00
parent 8b96d51da8
commit 2f653c0f17

View File

@ -1,5 +1,7 @@
using System.Drawing.Drawing2D;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using System.Xml.Linq;
namespace Practika namespace Practika
{ {
@ -89,8 +91,6 @@ namespace Practika
private void button8_Click_1(object sender, EventArgs e) private void button8_Click_1(object sender, EventArgs e)
{ {
textBoxMassive.Clear(); textBoxMassive.Clear();
string input = textBoxTake.Text; string input = textBoxTake.Text;
string[] rows = input.Split(';'); string[] rows = input.Split(';');
CountLine = rows.Length; CountLine = rows.Length;
@ -108,7 +108,7 @@ namespace Practika
} }
else else
{ {
MessageBox.Show("Îøèáêà !"); MessageBox.Show("!");
return; return;
} }
} }
@ -124,6 +124,8 @@ namespace Practika
} }
private void button9_Click_1(object sender, EventArgs e) private void button9_Click_1(object sender, EventArgs e)
{ {
@ -191,21 +193,21 @@ namespace Practika
int l = -1; int l = -1;
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
{ {
if (array1[i] > 0) if (array1[i] < 0 && l != 0)
{ {
l= i; l = i;
} }
} }
for (int i = n - 1; i > l+1; i--) for (int i = n - 1; i > l + 1; i--)
{ {
array1[i] = array1[i - 1]; array1[i] = array1[i - 1];
} }
if (l + 1 <= n)
{ array1[l + 1] = -1;
array1[l+ 1] = -1;
}
textBoxEnd.Text = string.Join(" ", array1); textBoxEnd.Text = string.Join(" ", array1);
@ -215,11 +217,108 @@ namespace Practika
case 4: case 4:
int w = Array1size ;
int o = 0;
for (int i = 0; i <w; i++)
{
if (array1[i]%2 == 0 && o==0)
{
o++;
for (int j = i; j < w - 1; j++)
{
array1[j] = array1[j + 1];
}
w--;
i--;
}
}
for (int i = 0; i < w; i++)
{
textBoxEnd.Text += array1[i].ToString() + " ";
}
break; break;
case 5 : case 5:
int maxPosValue = int.MinValue;
int columnToDelete = -1;
for (int j = 0; j < CountLine; j++)
{
for (int i = 0; i < Count; i++)
{
if (array2[i, j] > maxPosValue && array2[i, j] < 0)
{
maxPosValue = array2[i, j];
columnToDelete = j;
}
}
}
for (int j = columnToDelete; j < CountLine - 1; j++)
{
for (int i = 0; i < Count; i++)
{
array2[i, j] = array2[i, j + 1];
}
}
for (int i = 0; i < Count; i++)
{
array2[i, Count - 1] = 0;
}
for (int i = 0; i < Count; i++)
{
for (int j = 0; j < CountLine - 1; j++)
{
textBoxEnd.Text += array2[i, j].ToString() + " ";
}
textBoxEnd.Text += Environment.NewLine;
}
break; break;
case 6: case 6:
int minElement = int.MaxValue;
int rowWithMinElement = -1;
for (int i = 0; i < Count; i++)
{
for (int j = 0; j < CountLine; j++)
{
if (array2[i, j] < minElement)
{
minElement = array2[i, j];
rowWithMinElement = i;
}
}
}
for (int j = 0; j <Count - 1; j++)
{
for (int k = 0; k < CountLine- 1 - j; k++)
{
if (array2[rowWithMinElement, k] > array2[rowWithMinElement, k + 1])
{
for (int i = 0; i <Count; i++)
{
int ww = array2[i, k];
array2[i, k] = array2[i, k + 1];
array2[i, k + 1] =ww;
}
}
}
}
for (int i = 0; i < Count; i++)
{
for (int j = 0; j < CountLine; j++)
{
textBoxEnd.Text += array2[i, j].ToString() + " ";
}
textBoxEnd.Text += Environment.NewLine;
}
break; break;