VERSION 5.00
Begin VB.Form Form1 
   AutoRedraw      =   -1  'True
   BackColor       =   &H00FFFFC0&
   Caption         =   "Массивы"
   ClientHeight    =   7965
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   8880
   LinkTopic       =   "Form1"
   ScaleHeight     =   7965
   ScaleWidth      =   8880
   StartUpPosition =   3  'Windows Default
   Begin VB.Timer Timer1 
      Interval        =   1
      Left            =   7920
      Top             =   3600
   End
   Begin VB.CommandButton Command9 
      Caption         =   "Поиск max"
      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            =   7560
      TabIndex        =   8
      Top             =   5280
      Width           =   1095
   End
   Begin VB.TextBox Text1 
      BackColor       =   &H00800080&
      BeginProperty Font 
         Name            =   "Georgia"
         Size            =   12
         Charset         =   204
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0000FF00&
      Height          =   1215
      Left            =   6240
      MultiLine       =   -1  'True
      TabIndex        =   7
      Text            =   "Массив.frx":0000
      Top             =   1080
      Width           =   2415
   End
   Begin VB.CommandButton Command5 
      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            =   7560
      TabIndex        =   6
      Top             =   4440
      Width           =   1095
   End
   Begin VB.CommandButton Command8 
      Caption         =   "сорт2"
      Height          =   495
      Left            =   6240
      TabIndex        =   5
      Top             =   6600
      Width           =   1095
   End
   Begin VB.CommandButton Command7 
      Caption         =   "Поиск min"
      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            =   7560
      TabIndex        =   4
      Top             =   5880
      Width           =   1095
   End
   Begin VB.CommandButton Command4 
      Caption         =   "сорт1"
      Height          =   495
      Left            =   6240
      TabIndex        =   3
      Top             =   5280
      Width           =   1095
   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            =   7560
      TabIndex        =   2
      Top             =   7200
      Width           =   1095
   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            =   6240
      TabIndex        =   1
      Top             =   7200
      Width           =   1095
   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            =   6240
      TabIndex        =   0
      Top             =   5880
      Width           =   1095
   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 3) 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
Command7.Enabled = True
Command8.Enabled = False
Command9.Enabled = True

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(2) = True
fl(1) = False
Command8.Enabled = True
Command7.Enabled = True
Command4.Enabled = False
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
   Form1.FontUnderline = True
   Form1.ForeColor = 255

For j = 1 To m - 1
For i = 1 To m - 1
 If a(i) > a(i + 1) Then
 r = a(i)
 a(i) = a(i + 1)
 a(i + 1) = r
 End If
 Next
 Next
 Form1.Print
 For i = 1 To m
 Form1.Print a(i);
Next
fl(1) = True
fl(2) = False

End Sub

Private Sub Command5_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 Command6_Click()
'chas = Date
'
'End Sub

Private Sub Command7_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

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; "шт"
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; "шт"
End If

End Sub

Private Sub Command8_Click()
Dim Now(1 To 1000) As Integer
Form1.FontSize = 12
Form1.ForeColor = &HC000C0
Form1.FontBold = True
Form1.FontUnderline = True
Form1.ForeColor = 255

c = 0
k = 0

For i = 1 To n
 For j = 1 To m
   c = c + 1
   Now(c) = b(i, j)
 Next
Next

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

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

End Sub

Private Sub Command9_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

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 "max="; Min, cc; "шт"
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 "max="; Min, cc; "шт"
End If

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

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; "шт"
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; "шт"
End If
If fl(3) = False Then
'Command6.Visible = True
Text1.Visible = True
fl(3) = True
Else
'Command6.Visible = False
Text1.Visible = False
fl(3) = False
End If

End Sub

Private Sub Form_Load()
Command4.Enabled = False
Command8.Enabled = False
Command7.Enabled = False
Command9.Enabled = False
Command1.Enabled = False
Command2.Enabled = False
'Command6.Visible = 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
Command8.Top = ScaleHeight - 1300
Command8.Left = ScaleWidth - 2650
Command4.Top = ScaleHeight - 2700
Command4.Left = ScaleWidth - 2650
Command7.Top = ScaleHeight - 2100
Command7.Left = ScaleWidth - 1300
Command9.Top = ScaleHeight - 2700
Command9.Left = ScaleWidth - 1300
Command5.Top = ScaleHeight - 3500
Command5.Left = ScaleWidth - 1300
Command3.Left = ScaleWidth - 1300
Command3.Top = ScaleHeight - 700
'Command6.Top = ScaleHeight - 5600
'Command6.Left = ScaleWidth - 1400
Text1.Top = ScaleHeight - 6600
Text1.Left = ScaleWidth - 2600

End Sub

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

End Sub
