130-20 guruh talabasi Yakubov Asadbek
4-topshiriq. Hash table
using System;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Linq;
usingSystem.Text;
usingSystem.Threading.Tasks;
usingSystem.Windows.Forms;
namespace WindowsFormsApplication9
{
publicpartialclassForm1 : Form
{
publicForm1()
{
InitializeComponent();
}
privatevoid button1_Click(object sender, EventArgs e)
{
string[] son = richTextBox1.Text.Split();
int[] numb = newint[son.Length];
int k = Convert.ToInt32(textBox1.Text);
boolholat = false;
for (inti = 0; i{
numb[i] = Convert.ToInt32(son[i]);
}
for (inti = 0; i{
for (int j = 0; j {
if (k == numb[i] + numb[j])
{
holat = true;
richTextBox2.Text = true.ToString();
break;
}
}
}
if (!holat)
{
richTextBox2.Text = false.ToString();
}
}
privatevoid button2_Click(object sender, EventArgs e)
{
bool holat2 = false;
string[] arr = richTextBox4.Text.Split();
for (inti = 0; i
{
for(int j=0;j{
if (arr[i] == arr[j] &&i!=j)
{
holat2 = true;
richTextBox3.Text = true.ToString();
break;
}
}
}
if (!holat2)
{
richTextBox3.Text = false.ToString();
}
}
privatevoid richTextBox8_TextChanged(object sender, EventArgs e)
{
}
privatevoid button3_Click(object sender, EventArgs e)
{
richTextBox5.Clear();
int son=Convert.ToInt32(textBox2.Text);
string[] array1 = richTextBox6.Text.Split();
string[] array2 = richTextBox7.Text.Split();
string[] array3 = richTextBox8.Text.Split();
string[] array4 = richTextBox9.Text.Split();
int[] numb1 = newint[array1.Length];
int[] numb2 = newint[array2.Length];
int[] numb3 = newint[array3.Length];
int[] numb4 = newint[array4.Length];
for (inti = 0; i< array1.Length; i++)
{
numb1[i] = Convert.ToInt32(array1[i]);
}
for (inti = 0; i< array2.Length; i++)
{
numb2[i] = Convert.ToInt32(array2[i]);
}
for (inti = 0; i< array3.Length; i++)
{
numb3[i] = Convert.ToInt32(array3[i]);
}
for (inti = 0; i< array4.Length; i++)
{
numb4[i] = Convert.ToInt32(array4[i]);
}
for (inti = 0; i< array1.Length; i++)
{
for (int j = 0; j < array2.Length; j++)
{
for (int k = 0; k < array3.Length; k++)
{
for (int l = 0; l < array4.Length; l++)
{
if ((numb1[i] + numb2[j] + numb3[k] + numb4[l]) == son)
{
richTextBox5.Text += (numb1[i] + ", " + numb2[j] + ", " + numb3[k] + ", " + numb4[l] + "\n");
}
}
}
}
}
}
privatevoid richTextBox1_TextChanged(object sender, EventArgs e)
{
}
privatevoid groupBox1_Enter(object sender, EventArgs e)
{
}
privatevoid Form1_Load(object sender, EventArgs e)
{
}
}
}
1-masala
2-masala
3-masala
4.1 topsgiriq. Qat’iy ortib borayotgan bog'langan ro'yxat Yagona bog'langan ro'yxatning boshin ihisobga olgan holda head, tugunlarning qiymatlari qat'iy ortib borayotgan tartibda tartiblanganligini qaytaring.
using System;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Linq;
usingSystem.Text;
usingSystem.Threading.Tasks;
usingSystem.Windows.Forms;
using System.IO;
namespace _4_topshiriq
{
publicpartialclassForm1 : Form
{
publicForm1()
{
InitializeComponent();
}
privatevoid textBox1_TextChanged(object sender, EventArgs e)
{
}
privatevoid button1_Click(object sender, EventArgs e)
{
String[] satr = richTextBox1.Text.Split();
int[] list = newint[satr.Length];
boolholat = false;
for (inti = 0; i{
list[i] = Convert.ToInt32(satr[i]);
}
for (inti = 0; i< list.Length-1; i++)
{
if (!(list[i] < list[i + 1]))
{
holat = true;
break;
}
}
if (holat)
{
textBox1.Text = "Yolg'on";
}
else
{
textBox1.Text = "Rost";
}
}
privatevoid button2_Click(object sender, EventArgs e)
{
textBox2.Clear();
string[] str = richTextBox2.Text.Split();
int l = 0;
boolhol = false;
for (inti = 0; i{
for (int j = i + 1; j {
if (str[i]==str[j])
{
str[j] = " ";
hol = true;
}
}
if (hol) str[i] = " ";
hol = false;
}
for (inti = 0; i{
if (str[i] != "")
{
textBox2.Text += str[i] + " ";
}
}
}
privatevoid button3_Click(object sender, EventArgs e)
{
Listikkilik = new List(richTextBox3.Text.Split(' '));
double s=0;
for (inti = ikkilik.Count - 1, j = 0; i>= 0; j++, i--)
{
s += Convert.ToDouble(ikkilik[i]) * Math.Pow(2, j);
}
textBox3.Text = s.ToString();
}
privatevoid button4_Click(object sender, EventArgs e)
{
textBox4.Clear();
List array = new List(richTextBox4.Text.Split());
stringmaqsad = textBox5.Text;
foreach (var iin array)
{
if (!(maqsad == i))
{
textBox4.Text += i+" ";
}
}
}
privatevoid richTextBox1_TextChanged(object sender, EventArgs e)
{
}
}
}
6-topshiriq. Berilgan misollarni o’ztartib raqamingizda ginitanlabolasizla. Hisoblash ketma-ketligini Li algoritmiga ko’ra amalga oshiring va yo’lingizni ham istalgan dasturlash muhitida ko’rsating?
Do'stlaringiz bilan baham: |