Praktika_Pibd-14/Praktika/Form1.cs

821 lines
26 KiB
C#
Raw Normal View History

2024-06-28 09:22:17 +04:00
using System;
2024-06-25 22:22:18 +04:00
using System.Drawing;
using System.Linq;
2024-06-28 09:22:17 +04:00
using System.Reflection;
2024-06-25 22:22:18 +04:00
using System.Text;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
namespace Praktika
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int[,] array2D;
2024-06-28 09:22:17 +04:00
int[] array;
2024-06-25 22:22:18 +04:00
public static int flag = 0;
2024-06-28 09:22:17 +04:00
string result;
int len;
2024-06-25 22:22:18 +04:00
private void ButtonOne_Click(object sender, EventArgs e)
{
2024-06-28 09:22:17 +04:00
//<2F><><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
if (arrayTextBox.Text.Length > 0 && textBoxLen.Text.Length >5 )
{
Vvod();
return;
}
if (textBoxLen.Text == null)
{
MessageBox.Show("<22><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
return;
}
if (string.IsNullOrEmpty(textBoxMin.Text) || string.IsNullOrEmpty(textBoxMax.Text))
2024-06-25 22:22:18 +04:00
{
MessageBox.Show("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.");
return;
}
2024-06-28 09:22:17 +04:00
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
len = Convert.ToInt32(textBoxLen.Text);
array = new int[len * 2];
2024-06-25 22:22:18 +04:00
Random random = new Random();
2024-06-28 09:22:17 +04:00
for (int i = 0; i < len; i++)
{
array[i] = random.Next(Convert.ToInt32(textBoxMin.Text), Convert.ToInt32(textBoxMax.Text));
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> 0
string str = ""; for (int i = 0; i < len; i++)
{
str += array[i].ToString();
str += " ";
}
arrayTextBox.Text = str;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/*len = Convert.ToInt32(textBoxLen.Text);
array = new int[len ];
Random random = new Random();
for (int i = 0; i < len; i++)
2024-06-25 22:22:18 +04:00
{
array[i] = random.Next(Convert.ToInt32(textBoxMin.Text), Convert.ToInt32(textBoxMax.Text));
2024-06-28 09:22:17 +04:00
}*/
//arrayTextBox.Text = string.Join(", ", array);
}
private void Vvod()
{
string[] mas = arrayTextBox.Text.Split(' ');
len = mas.Length;
array = new int[len * 2];
for (int i = 0; i < len; i++)
{
array[i] = Convert.ToInt32(mas[i]);
2024-06-25 22:22:18 +04:00
}
}
private void ButtonTwo_Click(object sender, EventArgs e)
{
2024-06-28 09:22:17 +04:00
if (arrayTextBox.Text.Length > 0 && textBoxLen.Text.Length > 5)
{
Vvod2();
return;
}
if (textBoxLen.Text == null)
{
MessageBox.Show("<22><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
return;
}
if (string.IsNullOrEmpty(textBoxMin.Text) || string.IsNullOrEmpty(textBoxMax.Text))
2024-06-25 22:22:18 +04:00
{
MessageBox.Show("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.");
return;
}
2024-06-28 09:22:17 +04:00
len = Convert.ToInt32(textBoxLen.Text);
array2D = new int[len * 2, len * 2];
2024-06-25 22:22:18 +04:00
Random random = new Random();
2024-06-28 09:22:17 +04:00
for (int i = 0; i < len; i++)
2024-06-25 22:22:18 +04:00
{
2024-06-28 09:22:17 +04:00
for (int j = 0; j < len; j++)
2024-06-25 22:22:18 +04:00
{
array2D[i, j] = random.Next(Convert.ToInt32(textBoxMin.Text), Convert.ToInt32(textBoxMax.Text));
}
}
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
2024-06-28 09:22:17 +04:00
string str = "";
for (int i = 0; i < len; i++)
2024-06-25 22:22:18 +04:00
{
2024-06-28 09:22:17 +04:00
for (int j = 0; j < len; j++)
{
str += array2D[i, j].ToString();
str += " ";
}
str += "\n";
}
arrayTextBox.Text = str;
/*StringBuilder sb = new StringBuilder();
for (int i = 0; i < len; i++)
{
for (int j = 0; j < len; j++)
2024-06-25 22:22:18 +04:00
{
sb.Append(array2D[i, j] + " ");
}
sb.AppendLine();
}
2024-06-28 09:22:17 +04:00
arrayTextBox.Text = sb.ToString();*/
}
private void Vvod2()
{
string[] mas = arrayTextBox.Text.Split(' ', '\n');
len = Convert.ToInt32(Math.Sqrt(mas.Length));
array2D = new int[len * 2, len * 2];
int c = 0;
for (int i = 0; i < len; i++)
{
for (int j = 0; j < len; j++)
{
array2D[i, j] = Convert.ToInt32(mas[c++]);
}
}
2024-06-25 22:22:18 +04:00
}
private void Button1_Click(object sender, EventArgs e)
{
2024-06-28 09:22:17 +04:00
//<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
2024-06-25 22:22:18 +04:00
int[] array = Array.ConvertAll(arrayTextBox.Text.Split(','), int.Parse);
2024-06-28 09:22:17 +04:00
int minLength = 999;
2024-06-25 22:22:18 +04:00
int seriesStartIndex = 0;
int seriesLength = 0;
2024-06-28 09:22:17 +04:00
int i = 1;
int currentLength = 1;
for (; i < array.Length; i++)
2024-06-25 22:22:18 +04:00
{
2024-06-28 09:22:17 +04:00
if (array[i] < 0 && array[i - 1] < 0 || array[i] >= 0 && array[i - 1] >= 0)
2024-06-25 22:22:18 +04:00
{
2024-06-28 09:22:17 +04:00
currentLength++;
}
else
{
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (currentLength < minLength && currentLength >= 2)
2024-06-25 22:22:18 +04:00
{
2024-06-28 09:22:17 +04:00
minLength = currentLength;
seriesStartIndex = i - currentLength; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
seriesLength = currentLength;
2024-06-25 22:22:18 +04:00
}
2024-06-28 09:22:17 +04:00
currentLength = 1;
2024-06-25 22:22:18 +04:00
}
2024-06-28 09:22:17 +04:00
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
if (currentLength < minLength && currentLength >= 2)
{
minLength = currentLength;
seriesStartIndex = i - currentLength; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
seriesLength = currentLength;
2024-06-25 22:22:18 +04:00
}
2024-06-28 09:22:17 +04:00
MessageBox.Show($"<22><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> {seriesStartIndex} <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> {seriesLength}");
2024-06-25 22:22:18 +04:00
flag = 1;
2024-06-28 09:22:17 +04:00
result = "<22><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> " + seriesStartIndex + " <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> " + seriesLength;
2024-06-25 22:22:18 +04:00
}
private void Button9_Click(object sender, EventArgs e)
{
if (flag == 1)
{
2024-06-28 09:22:17 +04:00
richTextBox1.Text = "<22><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> N. <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD>" +
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD>" +
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD>" +
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>). <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.<2E><><EFBFBD><EFBFBD><EFBFBD>" +
"<22><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" +
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>.";
2024-06-25 22:22:18 +04:00
}
else if (flag == 2)
{
2024-06-28 09:22:17 +04:00
richTextBox1.Text = "7. <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> N. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>\r\n<><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>\r\n<><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
2024-06-25 22:22:18 +04:00
}
else if (flag == 3)
{
2024-06-28 09:22:17 +04:00
richTextBox1.Text = "8. <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> N. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 3 <20><><EFBFBD><EFBFBD><EFBFBD>\r\n<><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20> <20><> <20><>\r\n<><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>).\r\n\r\n";
2024-06-25 22:22:18 +04:00
}
else if (flag == 4)
{
2024-06-28 09:22:17 +04:00
richTextBox1.Text = "8. <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> N. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\r\n<><6E><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20> <20><> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\r\n<><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD>).\r\n";
2024-06-25 22:22:18 +04:00
}
else if (flag == 5)
{
2024-06-28 09:22:17 +04:00
richTextBox1.Text = "8. <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> N*N. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\r\n<><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,\r\n<><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.";
2024-06-25 22:22:18 +04:00
}
else if (flag == 6)
{
2024-06-29 17:25:47 +04:00
richTextBox1.Text = "8. <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> N*N. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\r\n<><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD><EFBFBD>)";
2024-06-25 22:22:18 +04:00
}
else
{
MessageBox.Show("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
}
}
2024-06-28 09:22:17 +04:00
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
2024-06-25 22:22:18 +04:00
private void button10_Click(object sender, EventArgs e)
{
2024-06-28 09:22:17 +04:00
richTextBox1.Text = result;
2024-06-25 22:22:18 +04:00
}
private void Button2_Click(object sender, EventArgs e)
{
2024-06-28 09:22:17 +04:00
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2024-06-25 22:22:18 +04:00
int[] array = Array.ConvertAll(arrayTextBox.Text.Split(','), int.Parse);
int Min = int.MaxValue, minIndex = -1, Max = int.MinValue, maxIndex = -1;
2024-06-28 09:22:17 +04:00
2024-06-25 22:22:18 +04:00
for (int i = 0; i < array.Length; i++)
{
2024-06-28 09:22:17 +04:00
if (array[i] > Max && array[i] % 2 == 0)
2024-06-25 22:22:18 +04:00
{
Max = array[i];
maxIndex = i;
2024-06-28 09:22:17 +04:00
2024-06-25 22:22:18 +04:00
}
2024-06-28 09:22:17 +04:00
if (array[i] < Min && array[i] % 2 != 0)
2024-06-25 22:22:18 +04:00
{
Min = array[i];
minIndex = i;
2024-06-28 09:22:17 +04:00
2024-06-25 22:22:18 +04:00
}
}
2024-06-28 09:22:17 +04:00
if (maxIndex != -1 && minIndex != -1)
{
int begin = Math.Min(minIndex, maxIndex) + 1, end = Math.Max(minIndex, maxIndex) - 1;
for (; begin < end; begin++, end--)
{
int tmp = array[begin];
array[begin] = array[end];
array[end] = tmp;
}
}
else
{
MessageBox.Show("<22><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
return;
}
/*int begin = Math.Min(minIndex, maxIndex) + 1, end = Math.Max(minIndex, maxIndex) - 1;
2024-06-25 22:22:18 +04:00
for (; begin < end; begin++, end--)
{
int tmp = array[begin];
array[begin] = array[end];
array[end] = tmp;
2024-06-28 09:22:17 +04:00
}*/
result = string.Join(", ", array);
flag = 2;
2024-06-25 22:22:18 +04:00
}
private void Button3_Click(object sender, EventArgs e)
{
2024-06-28 09:22:17 +04:00
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1 <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
//int[] array = Array.ConvertAll(arrayTextBox.Text.Split(','), int.Parse); // <20><> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
2024-06-25 22:22:18 +04:00
2024-06-28 09:22:17 +04:00
/*for (int i = 0; i < len; i++)
2024-06-25 22:22:18 +04:00
{
2024-06-28 09:22:17 +04:00
if (array[i] >= 0 )
2024-06-25 22:22:18 +04:00
{
2024-06-28 09:22:17 +04:00
//Array.Resize(ref array, array.Length + 1); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> 1
//len++;
for (int j = len - 1; j > i + 1; j--) // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> 1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2024-06-25 22:22:18 +04:00
{
array[j] = array[j - 1];
}
2024-06-28 09:22:17 +04:00
array[i + 1] = 1; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> 1 <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2024-06-25 22:22:18 +04:00
i++; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> 2
}
2024-06-28 09:22:17 +04:00
}*/
//int n = array.Length;
int count = len;
int i = 0;
for (; i < count; i++)
{
if (array[i] % 2 != 0)
{
for (int j = count; j > i; j--)
{
array[j] = array[j - 1];
}
array[i + 1] = 3;
count++;
i++;
}
}
string str = ""; for (i = 0; i < count; i++)
{
str += array[i].ToString();
str += " ";
}
result = str;
//result = string.Join(", ", array);
/*for (int i = n - 1; i >= 0; i--)
{
if (array[i] > 0)
{
for (int j = n - 1; j > i + 1; j--)
{
array[j] = array[j - 1];
}
array[i + 1] = 1;
len++;
}
}*/
/*int k = 0;
for(int i = 0; i < array.Length; i++)
{
if (array[i] >= 0)
{
k++;
}
}*/ //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/*int[] newArray = new int[array.Length ];
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int j = 0;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
for (int i = 0; i < array.Length; i++)
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
newArray[j] = array[i];
j++;
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1
if (array[i] >= 0)
{
newArray[j] = 1; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
j++;
}
2024-06-25 22:22:18 +04:00
}
2024-06-28 09:22:17 +04:00
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
array = newArray;*/
//result = string.Join(", ", array);
flag = 3;
2024-06-25 22:22:18 +04:00
}
private void Button4_Click(object sender, EventArgs e)
{
2024-06-28 09:22:17 +04:00
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
//int[] array = Array.ConvertAll(arrayTextBox.Text.Split(','), int.Parse);
2024-06-25 22:22:18 +04:00
2024-06-28 09:22:17 +04:00
/*for (int i = 0; i < array.Length; i++)
2024-06-25 22:22:18 +04:00
{
2024-06-28 09:22:17 +04:00
if (array[i] > 0)
2024-06-25 22:22:18 +04:00
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> 1
for (int j = i; j < array.Length - 1; j++) // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> 1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
array[j] = array[j + 1];
}
Array.Resize(ref array, array.Length - 1);
i--;
}
}
2024-06-28 09:22:17 +04:00
result = string.Join(", ", array);*/
int count = len;
int i = 0;
for (; i < count; i++)
{
if (array[i] % 2 != 0)
{
for (int j = i; j < count ; j++)
{
array[j] = array[j + 1];
}
count--;
i--;
if (count == 0)
{
result = "<22><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
return;
}
}
}
string str = " "; for (i = 0; i < count; i++)
{
str += array[i].ToString();
str += " ";
}
result = str;
flag = 4;
2024-06-25 22:22:18 +04:00
}
private void Button5_Click(object sender, EventArgs e)
{
2024-06-28 09:22:17 +04:00
/*int s = 0;
float ar = 0;
for (int j = 0; j < columns; j++)
{
for (int i = 0; i < rows; i++)
{
if (array2D[i, j] >= 0)
{
s += array2D[i, j];
}
}
}
ar = s / rows;
for (int j = 0; j < columns; j++)
{
for (int i = 0; i < rows; i++)
{
if (array2D[i,j] > ar)
{
for (int k = columns; k > j; k--)
{
for (int p = 0; p < rows; p++)
{
array2D[p, k] = 0;
}
}
columns++;
j++;
break;
}
}
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < columns; j++)
{
sb.Append(array2D[i, j] + " ");
}
sb.AppendLine();
}
richTextBox1.Text = sb.ToString();
//richTextBox1.Text = array2D.ToString();
//result = string.Join(" ", array2D);*/
2024-06-29 17:25:47 +04:00
int s = 0;
2024-06-28 09:22:17 +04:00
double ar = 0;
int len2 = len;
for (int j = 0; j < len2; j++)
{
for (int i = 0; i < len; i++)
{
2024-06-29 17:25:47 +04:00
if (array2D[i, j] < 0 )
2024-06-28 09:22:17 +04:00
{
s += array2D[i, j];
}
}
}
2024-06-29 17:25:47 +04:00
ar = (double)s / (len * len2);
2024-06-28 09:22:17 +04:00
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 5
for (int j = 0; j < len2; j++)
{
for (int i = 0; i < len; i++)
{
2024-06-29 17:25:47 +04:00
if (Math.Abs(array2D[i, j]) > ar && array2D[i,j] != 0)
2024-06-28 09:22:17 +04:00
{
for (int k = len2; k > j; k--)
{
for (int p = 0; p < len; p++)
{
array2D[p, k] = array2D[p, k - 1];
}
}
for (int p = 0; p < len; p++)
{
array2D[p, j + 1] = 0;
}
len2++;
j++;
}
}
}
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
string str = "";
for (int i = 0; i < len; i++)
{
for (int j = 0; j < len2; j++)
{
str += array2D[i, j].ToString();
str += " ";
}
str += "\n";
}
result = str;
2024-06-29 17:25:47 +04:00
flag = 5;
2024-06-28 09:22:17 +04:00
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 6
2024-06-29 17:25:47 +04:00
/*int s =0;
2024-06-28 09:22:17 +04:00
double ar ;
int len2 = len;
for (int j = 0; j < len2; j++)
{
for (int i = 0; i < len; i++)
{
s += array2D[i, j];
}
}
ar = (double)s / (len * len2);
for (int i = 0; i < len; i++)
{
for (int j = 0; j < len2; j++)
{
if (Math.Abs(array2D[i, j]) < ar)
{
for (int k = len; k > i; k--)
{
for (int p = 0; p < len2; p++)
{
array2D[k, p] = array2D[k - 1, p];
}
}
for (int p = 0; p < len2; p++)
{
array2D[i + 1, p] = 0;
}
len++;
i++;
break;
}
}
}
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
string str = "";
for (int i = 0; i < len; i++)
{
for (int j = 0; j < len2; j++)
{
str += array2D[i, j].ToString();
str += " ";
}
str += "\n";
}
result = str;
2024-06-29 17:25:47 +04:00
flag = 5;*/
2024-06-28 09:22:17 +04:00
/*StringBuilder sbResult = new StringBuilder();
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < columns; j++)
{
sbResult.Append(array2D[i, j] + " ");
}
sbResult.AppendLine();
}
richTextBox1.Text = sbResult.ToString();*/
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/*int insertCount = 0; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
for (int j = 0; j < len2; j++)
{
for (int i = 0; i < len; i++)
{
if (array2D[i, j] > ar)
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
for (int k = len2 - 1; k > j + insertCount; k--)
{
for (int p = 0; p < len; p++)
{
array2D[p, k] = array2D[p, k - 1];
}
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
for (int p = 0; p < len; p++)
{
array2D[p, j + insertCount] = 0;
}
insertCount++; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
break;
}
}
}*/
}
private void Button6_Click(object sender, EventArgs e)
{
/*for (int i = 0; i < len; i++)
{
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
//SortLP(array2D, i);
//SortSN(array2D, i);
for (int j = 0; j < len; j++)
{
for (int k = 0; k < len; k++)
{
if (array2D[i, k] < array2D[i, k + 1])
{
int temp = array2D[i, k];
array2D[i, k] = array2D[i, k + 1];
array2D[i, k + 1] = temp;
}
}
for (int k = 0; k < len; k++)
{
if (array2D[k, 0] < array2D[k + 1, r])
{
int temp = array2D[k, r];
array2D[k, r] = array2D[k + 1, r];
array2D[k + 1, r] = temp;
}
}
}
}*/
/*for (int i = 0; i < len*len; i++)
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
for (int row = 0; row < len; row++)
{
for (int k = 0; k < len - 1; k++)
{
if (array2D[row, k] < array2D[row, k + 1])
{
int temp = array2D[row, k];
array2D[row, k] = array2D[row, k + 1];
array2D[row, k + 1] = temp;
}
}
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
for (int col = 0; col < len ; col++)
{
for (int k = 0; k < len ; k++)
{
if (array2D[k, col] < array2D[k + 1, col])
{
int temp = array2D[k, col];
array2D[k, col] = array2D[k + 1, col];
array2D[k + 1, col] = temp;
}
}
}
}*/
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/*for (int i = 0; i < len; i++)
{
for (int j = 0; j < len; j++)
{
for (int x = 0; x < len; x++)
{
for (int y = 0; y < len; y++)
{
if (array2D[i, j] > array2D[x, y])
{
int zam = array2D[i, j];
array2D[i, j] = array2D[x, y];
array2D[x, y] = zam;
}
}
}
}
}*/
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD>
for (int i = len - 1; i >= 0; i--) // <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
for (int j = len - 1; j >= 0; j--) // <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
for (int x = len - 1; x >= 0; x--)
{
for (int y = len - 1; y >= 0; y--)
{
if (array2D[i, j] < array2D[x, y])
{
int zam = array2D[i, j];
array2D[i, j] = array2D[x, y];
array2D[x, y] = zam;
}
}
}
}
}
/*//<2F><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>
for (int k = 0; k < len; k++)
{
if (array2D[0, k] < array2D[0, k + 1])
{
int temp = array2D[0, k];
array2D[0, k] = array2D[0, k + 1];
array2D[0, k + 1] = temp;
}
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
for (int k = 0; k < len; k++)
{
if (array2D[k, 0] < array2D[k + 1, 0])
{
int temp = array2D[k, 0];
array2D[k, 0] = array2D[k + 1, 0];
array2D[k + 1, 0] = temp;
}
}*/
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
string str = "";
for (int i = 0; i < len; i++)
{
for (int j = 0; j < len; j++)
{
str += array2D[i, j].ToString();
str += " ";
}
str += "\n";
}
result = str;
2024-06-29 17:25:47 +04:00
flag = 6;
2024-06-28 09:22:17 +04:00
}
public void SortLP(int[,] arr,int r)
{
//<2F><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>
for (int i = 0; i < len; i++)
{
for (int k = 0; k < len; k++)
{
if (array2D[r, k] < array2D[r, k + 1])
{
int temp = array2D[r, k];
array2D[r, k] = array2D[r, k + 1];
array2D[r, k + 1] = temp;
}
}
}
2024-06-25 22:22:18 +04:00
}
2024-06-28 09:22:17 +04:00
public void SortSN(int[,] arr, int r)
{
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
for (int i = 0; i < len; i++)
{
for (int k = 0; k < len; k++)
{
if (array2D[k, r] < array2D[k + 1, r])
{
int temp = array2D[k, r];
array2D[k, r] = array2D[k + 1, r];
array2D[k + 1, r] = temp;
}
}
}
}
2024-06-25 22:22:18 +04:00
}
}