VERSION 5.00
Begin VB.Form Form1 
   BackColor       =   &H00FFFF80&
   Caption         =   "Form1"
   ClientHeight    =   7935
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   8625
   LinkTopic       =   "Form1"
   ScaleHeight     =   7935
   ScaleWidth      =   8625
   StartUpPosition =   3  'Windows Default
   Begin VB.Timer Timer1 
      Interval        =   1
      Left            =   7680
      Top             =   3720
   End
   Begin VB.TextBox Text1 
      BeginProperty Font 
         Name            =   "Georgia"
         Size            =   12
         Charset         =   204
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1215
      Left            =   6360
      MultiLine       =   -1  'True
      TabIndex        =   9
      Top             =   1200
      Width           =   2175
   End
   Begin VB.CommandButton Command9 
      Caption         =   "Вставка строки"
      Height          =   495
      Left            =   7080
      TabIndex        =   8
      Top             =   5400
      Width           =   1215
   End
   Begin VB.CommandButton Command8 
      Caption         =   "Вставка столбца"
      Height          =   495
      Left            =   7080
      TabIndex        =   7
      Top             =   6000
      Width           =   1215
   End
   Begin VB.CommandButton Command7 
      Caption         =   "Удаление строки"
      Height          =   495
      Left            =   7080
      TabIndex        =   6
      Top             =   6720
      Width           =   1215
   End
   Begin VB.CommandButton Command6 
      Caption         =   "Ввод m,n"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   204
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   7080
      TabIndex        =   5
      Top             =   4680
      Width           =   1215
   End
   Begin VB.CommandButton Command5 
      Caption         =   "Удаление столбца"
      Height          =   495
      Left            =   5640
      TabIndex        =   4
      Top             =   6720
      Width           =   1215
   End
   Begin VB.CommandButton Command4 
      Caption         =   "Удаление элемента"
      Height          =   495
      Left            =   5640
      TabIndex        =   3
      Top             =   5400
      Width           =   1215
   End
   Begin VB.CommandButton Command3 
      Caption         =   "Выход"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   204
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   7080
      TabIndex        =   2
      Top             =   7320
      Width           =   1215
   End
   Begin VB.CommandButton Command2 
      Caption         =   "Массив2"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   204
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   5640
      TabIndex        =   1
      Top             =   7320
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Массив1"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   204
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   5640
      TabIndex        =   0
      Top             =   6000
      Width           =   1215
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim chas As Integer, minut As Integer, m As Integer, n As Integer, fl(1 To 2) As Boolean, Min As Integer, cc As Integer, kk As Integer, c As Integer, k As Integer, r As Integer, a(1 To 40) As Integer, b(1 To 40, 1 To 40) As Integer, i As Integer, j As Integer, fo As Single
Private Sub Command1_Click()
 Randomize (Timer)
 Form1.FontSize = 12
 Form1.ForeColor = &HC000C0
 Form1.FontBold = True
   Form1.FontUnderline = True
Form1.Cls
 Form1.Print "1-й массив - одномерный (линейный) случайных целых чисел"
  Form1.FontUnderline = False
   Form1.ForeColor = 255
For i = 1 To m
 a(i) = Int(Rnd * 900 + 100)
 Form1.Print a(i);
Next
fl(1) = True
fl(2) = False
Command4.Enabled = True
Command5.Enabled = False
Command7.Enabled = False
Command8.Enabled = False
Command9.Enabled = False

End Sub

Private Sub Command2_Click()
 Randomize (Timer)
 Form1.FontSize = 12
 Form1.ForeColor = &HC000C0
 Form1.FontItalic = True
 Form1.FontBold = True
  Form1.FontUnderline = True
Form1.Cls
 Form1.Print "2-й массив - двумерный (таблица) случайных целых чисел"
 Form1.FontItalic = False
  Form1.FontUnderline = False
   Form1.ForeColor = 255

For i = 1 To n
 For j = 1 To m
 b(i, j) = Int(Rnd * 900 + 100)
 Form1.Print b(i, j);
Next
Form1.Print
Next
fl(1) = False
fl(2) = True
Command4.Enabled = False
Command5.Enabled = True
Command7.Enabled = True
Command8.Enabled = True
Command9.Enabled = True

End Sub

Private Sub Command3_Click()
End
End Sub

Private Sub Command4_Click()
 Form1.FontSize = 12
 Form1.ForeColor = &HC000C0
 Form1.FontBold = True
5   c = InputBox("№ удаляемого числа")
  If c > m Then GoTo 5
Form1.Cls
 Form1.FontUnderline = True
 Form1.Print "1-й массив - одномерный (линейный) случайных целых чисел"
  Form1.FontUnderline = False

For i = 1 To m
  If i = c Then
   Form1.ForeColor = 255
   Form1.Print a(i);
  Else
   Form1.ForeColor = 555555
   Form1.Print a(i);
  End If
Next
Form1.Print " Исходный массив"
Form1.Print
For i = 1 To m - 1
If i >= c Then
a(i) = a(i + 1)
End If
Next

m = m - 1
   Form1.ForeColor = 555555
Form1.Print
For i = 1 To m
 Form1.Print a(i);
Next
Form1.Print " Новый массив"
fl(1) = True
fl(2) = False
Command4.Enabled = True
Command7.Enabled = False

 
End Sub

Private Sub Command5_Click()
 Form1.FontSize = 12
 Form1.ForeColor = &HC000C0
 Form1.FontItalic = True
 Form1.FontBold = True
2    c = InputBox("№ удаляемого столбца")
  If c > m Then GoTo 2
Form1.Cls
Form1.FontUnderline = True
 Form1.Print "2-й массив - двумерный (таблица) случайных целых чисел"
 Form1.FontItalic = False
  Form1.FontUnderline = False
   Form1.ForeColor = 255
 

Form1.Print " Исходный массив"

For i = 1 To n
 For j = 1 To m

  If j = c Then
   Form1.ForeColor = 255
   Form1.Print b(i, j);
  Else
   Form1.ForeColor = 555555
   Form1.Print b(i, j);
  End If
 Next
 Form1.Print
Next

For i = 1 To n
 For j = 1 To m - 1
  If j >= c Then
   b(i, j) = b(i, j + 1)
  End If
 Next
Next

m = m - 1
  Form1.ForeColor = 555555
Form1.Print
Form1.Print " Новый массив"

For i = 1 To n
 For j = 1 To m
  Form1.Print b(i, j);
 Next
Form1.Print
Next

fl(1) = False
fl(2) = True
Command4.Enabled = False
Command5.Enabled = True


End Sub

Private Sub Command6_Click()
 Form1.FontSize = 12
 Form1.ForeColor = &HC000C0
 Form1.FontBold = True

1 m = InputBox("Введите m - число столбцов (не более 30)")
If m > 30 Then GoTo 1
2 n = InputBox("Введите n - число строк (не более 30)")
If n > 30 Then GoTo 2
Command1.Enabled = True
Command2.Enabled = True

End Sub

Private Sub Command7_Click()
 Form1.FontSize = 12
 Form1.ForeColor = &HC000C0
 Form1.FontItalic = True
 Form1.FontBold = True
1    c = InputBox("№ удаляемой строки")
 If c > n Then GoTo 1
Form1.Cls
Form1.FontUnderline = True
 Form1.Print "2-й массив - двумерный (таблица) случайных целых чисел"
 Form1.FontItalic = False
  Form1.FontUnderline = False
   Form1.ForeColor = 255
 
Form1.Print " Исходный массив"

For i = 1 To n
 For j = 1 To m

  If i = c Then
   Form1.ForeColor = 255
   Form1.Print b(i, j);
  Else
   Form1.ForeColor = 555555
   Form1.Print b(i, j);
  End If
 Next
 Form1.Print
Next
Form1.Print
For i = 1 To n - 1
 For j = 1 To m
  If i >= c Then
   b(i, j) = b(i + 1, j)
  End If
 Next
Next

n = n - 1
  Form1.ForeColor = 555555
Form1.Print
Form1.Print " Новый массив"

For i = 1 To n
 For j = 1 To m
  Form1.Print b(i, j);
 Next
Form1.Print
Next

fl(1) = False
fl(2) = True
Command4.Enabled = False
Command5.Enabled = True
Command7.Enabled = True


End Sub

Private Sub Command8_Click()
 Form1.FontSize = 12
 Form1.ForeColor = &HC000C0
 Form1.FontItalic = True
 Form1.FontBold = True
4   c = InputBox("№ вставляемого столбца")
  If c > m + 1 Then GoTo 4
Form1.Cls
Form1.FontUnderline = True
 Form1.Print "2-й массив - двумерный (таблица) случайных целых чисел"
 Form1.FontItalic = False
  Form1.FontUnderline = False
   Form1.ForeColor = 255
 

Form1.Print " Исходный массив"

For i = 1 To n
 For j = 1 To m

  If j = c Then
   Form1.ForeColor = 255
   Form1.Print b(i, j);
  Else
   Form1.ForeColor = 555555
   Form1.Print b(i, j);
  End If
 Next
 Form1.Print
Next
Form1.Print

For i = 1 To n
 For j = m + 1 To c Step -1
  'If j >= c Then
   b(i, j) = b(i, j - 1)
  'End If
 Next
 b(i, c) = 100
Next
m = m + 1
Form1.ForeColor = 255
Form1.Print
Form1.Print " Новый массив"

For i = 1 To n
 For j = 1 To m

  If j = c Then
   Form1.ForeColor = 255
   Form1.Print b(i, j);
  Else
   Form1.ForeColor = 555555
   Form1.Print b(i, j);
  End If
 Next
 Form1.Print
Next

fl(1) = False
fl(2) = True
Command4.Enabled = False
Command5.Enabled = True


End Sub

Private Sub Command9_Click()
 Form1.FontSize = 12
 Form1.ForeColor = &HC000C0
 Form1.FontItalic = True
 Form1.FontBold = True
3  c = InputBox("№ вставляемой строки")
  If c > n + 1 Then GoTo 3
Form1.Cls
 Form1.FontUnderline = True
 Form1.Print "2-й массив - двумерный (таблица) случайных целых чисел"
 Form1.FontItalic = False
  Form1.FontUnderline = False
   Form1.ForeColor = 255
 
Form1.Print " Исходный массив"

For i = 1 To n
 For j = 1 To m
  If i = c Then
   Form1.ForeColor = 255
   Form1.Print b(i, j);
  Else
   Form1.ForeColor = 555555
   Form1.Print b(i, j);
  End If
 Next
 Form1.Print
Next
Form1.Print

For j = 1 To m
 For i = n + 1 To c Step -1
  'If j >= c Then
   b(i, j) = b(i - 1, j)
  'End If
 Next
 b(c, j) = 100
Next
n = n + 1
Form1.ForeColor = 255
Form1.Print
Form1.Print " Новый массив"

For i = 1 To n
 For j = 1 To m
  If i = c Then
   Form1.ForeColor = 255
   Form1.Print b(i, j);
  Else
   Form1.ForeColor = 555555
   Form1.Print b(i, j);
  End If
 Next
  Form1.Print
Next

fl(1) = False
fl(2) = True
Command4.Enabled = False
Command5.Enabled = True

End Sub

Private Sub Form_Click()
If fl(1) = True Then
 Form1.FontSize = 12
 Form1.ForeColor = &HC000C0
 Form1.FontBold = True
   Form1.FontUnderline = True
Form1.Cls
 Form1.Print "1-й массив - одномерный (линейный) случайных целых чисел"
  Form1.FontUnderline = False
   Form1.ForeColor = 555555
Text1.Visible = True

Min = a(1)
 c = 1
For i = 1 To m
 If Min > a(i) Then
 c = i
 Min = a(i)
 End If
Next
cc = 0
For i = 1 To m
  If Min = a(i) Then
   cc = cc + 1
   Form1.ForeColor = 255
   Form1.Print a(i);
   Else
   Form1.ForeColor = 555555
   Form1.Print a(i);
  End If
  Form1.ForeColor = 255
Next

Form1.Print
Form1.Print
Form1.Print "min="; Min, cc; "шт"
Else
Text1.Visible = False

End If

If fl(2) = True Then
 Form1.FontSize = 12
 Form1.ForeColor = &HC000C0
 Form1.FontItalic = True
 Form1.FontBold = True
  Form1.FontUnderline = True
Form1.Cls
 Form1.Print "2-й массив - двумерный (таблица) случайных целых чисел"
 Form1.FontItalic = False
  Form1.FontUnderline = False
   Form1.ForeColor = 555555

Min = b(1, 1)
 c = 1
 kk = 1

For i = 1 To n
For j = 1 To m
 If Min > b(i, j) Then
 Min = b(i, j)
 c = i
 kk = j
 End If
 
Next
Next
cc = 0
For i = 1 To n
 For j = 1 To m
  If Min = b(i, j) Then
   cc = cc + 1
   Form1.ForeColor = 255
   Form1.Print b(i, j);
   Else
   Form1.ForeColor = 555555
   Form1.Print b(i, j);
  End If
   Form1.ForeColor = 255
 Next
 Form1.Print
Next

 Form1.Print
Form1.Print "min="; Min, cc; "шт"
Text1.Visible = False
Else
Text1.Visible = True

End If

End Sub


Private Sub Form_Load()
Command4.Enabled = False
Command5.Enabled = False
Command7.Enabled = False
Command8.Enabled = False
Command9.Enabled = False
Command1.Enabled = False
Command2.Enabled = False
fo = Time
Text1.Visible = False
End Sub

Private Sub Form_Resize()
Command2.Top = ScaleHeight - 700
Command2.Left = ScaleWidth - 2650
Command1.Top = ScaleHeight - 2100
Command1.Left = ScaleWidth - 2650
Command4.Top = ScaleHeight - 2700
Command4.Left = ScaleWidth - 2650
Command7.Top = ScaleHeight - 1300
Command7.Left = ScaleWidth - 1300
Command8.Top = ScaleHeight - 2100
Command8.Left = ScaleWidth - 1300
Command9.Top = ScaleHeight - 2700
Command9.Left = ScaleWidth - 1300
Command5.Top = ScaleHeight - 1300
Command5.Left = ScaleWidth - 2650
Command3.Left = ScaleWidth - 1300
Command3.Top = ScaleHeight - 700
Command6.Top = ScaleHeight - 3600
Command6.Left = ScaleWidth - 1300

End Sub

Private Sub Timer1_Timer()
Text1.Text = "Дата " + Str(Date) + "    " + "Время " + Str(Time) + "   " + "Время работы " + Str(Time - fo)

End Sub
