using System using System Collections Generic using System

  • Slides: 18
Download presentation

using System; using System. Collections. Generic; using System. Component. Model; using System. Data; using

using System; using System. Collections. Generic; using System. Component. Model; using System. Data; using System. Drawing; using System. Linq; using System. Text; using System. Threading. Tasks; using System. Windows. Forms; namespace VP_ZCH { public partial class Form 1 : Form { int[, ] A; int M; int N; public Form 1() { Initialize. Component(); }

private void выход. Tool. Strip. Menu. Item_Click(object sender, Event. Args e) { Application. Exit();

private void выход. Tool. Strip. Menu. Item_Click(object sender, Event. Args e) { Application. Exit(); } private void о. Программе. Tool. Strip. Menu. Item_Click(object sender, Event. Args e) { Message. Box. Show("Студент: Петров Илья Львович n. Группа: ПБВ-82"); }

private void Form 1_Mouse. Down(object sender, Mouse. Event. Args e) { if (e. Button

private void Form 1_Mouse. Down(object sender, Mouse. Event. Args e) { if (e. Button == Mouse. Buttons. Right) { context. Menu. Strip 2. Show(this, new Point(e. X, e. Y)); } }

private void старт. Tool. Strip. Menu. Item_Click(object sender, Event. Args e) { M =

private void старт. Tool. Strip. Menu. Item_Click(object sender, Event. Args e) { M = 0; N = 0; if (text. Box 1. Text == "" | text. Box 2. Text == "") { Message. Box. Show("Введите размеры массива!"); return; } else if (!int. Try. Parse(text. Box 1. Text, out M) | !int. Try. Parse(text. Box 2. Text, out N)) { Message. Box. Show("Некорректный ввод!"); return; } if ((M < 0) | (M > 20) | (N < 0) | (N > 20)) { Message. Box. Show("Число строк и столбцов не должно превышать 20!"); return; }

data. Grid. View 1. Row. Count = N; data. Grid. View 1. Column. Count

data. Grid. View 1. Row. Count = N; data. Grid. View 1. Column. Count = M; A = new int[N, M]; Random rand = new Random(); for (int i = 0; i < N; i++) { for (int j = 0; j < M; j++) { A[i, j] = (int) (rand. Next. Double() * 66); data. Grid. View 1. Rows[i]. Cells[j]. Value = A[i, j]; } } }

private void минимум. Tool. Strip. Menu. Item_Click(object sender, Event. Args e) { if (data.

private void минимум. Tool. Strip. Menu. Item_Click(object sender, Event. Args e) { if (data. Grid. View 1. Rows. Count > 0) { int[] D = new int[M]; int min = A[0, 0]; int j = 0; int i = 0; for (; i < M; i++) { min = 100000; for (; j < N; j++) { if (min > A[j, i]) min = A[j, i]; } } j = 0; D[i] = min; }

data. Grid. View 2. Row. Count = 1; data. Grid. View 2. Column. Count

data. Grid. View 2. Row. Count = 1; data. Grid. View 2. Column. Count = D. Length; for (int t = 0; t < D. Length; t++) { data. Grid. View 2. Rows[0]. Cells[t]. Value = D[t]; } } else { return; } }

private void button 1_Click(object sender, Event. Args e) { старт. Tool. Strip. Menu. Item_Click(sender,

private void button 1_Click(object sender, Event. Args e) { старт. Tool. Strip. Menu. Item_Click(sender, e); } private void размер. Tool. Strip. Menu. Item_Click(object sender, Event. Args e) { text. Box 1. Visible = true; text. Box 2. Visible = true; label 1. Visible = true; label 2. Visible = true; } private void button 2_Click(object sender, Event. Args e) { минимум. Tool. Strip. Menu. Item_Click(sender, e); } } }