VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   7365
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   8325
   LinkTopic       =   "Form1"
   ScaleHeight     =   7365
   ScaleWidth      =   8325
   StartUpPosition =   3  'Windows Default
   Begin VB.Timer Timer1 
      Interval        =   1
      Left            =   7320
      Top             =   3000
   End
   Begin VB.TextBox Text1 
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   12
         Charset         =   204
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1215
      Left            =   5640
      MultiLine       =   -1  'True
      TabIndex        =   8
      Top             =   840
      Width           =   2535
   End
   Begin VB.CommandButton Command7 
      Caption         =   "Сорт2"
      Height          =   495
      Left            =   6960
      TabIndex        =   7
      Top             =   5520
      Width           =   1215
   End
   Begin VB.PictureBox Pic1 
      Height          =   5415
      Left            =   960
      Picture         =   "Массив символный.frx":0000
      ScaleHeight     =   5355
      ScaleWidth      =   4035
      TabIndex        =   6
      Top             =   1320
      Width           =   4095
   End
   Begin VB.CommandButton Command6 
      Caption         =   "Поиск"
      Height          =   495
      Left            =   6960
      TabIndex        =   5
      Top             =   4800
      Width           =   1215
   End
   Begin VB.CommandButton Command5 
      Caption         =   "Сорт1"
      Height          =   495
      Left            =   6960
      TabIndex        =   4
      Top             =   3600
      Width           =   1215
   End
   Begin VB.CommandButton Command4 
      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            =   5520
      TabIndex        =   3
      Top             =   6720
      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            =   6960
      TabIndex        =   2
      Top             =   6720
      Width           =   1215
   End
   Begin VB.CommandButton Command2 
      Caption         =   "Массив2"
      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            =   6960
      TabIndex        =   1
      Top             =   6120
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Массив1"
      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            =   6960
      TabIndex        =   0
      Top             =   4200
      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 alf As String, alv As String, m As Integer, n As Integer, fl(1 To 3) As Boolean, Min As String, cc As Integer, kk As Integer, c As Integer, k As Integer, r As String, a(1 To 40) As String, aa(1 To 40) As String, b(1 To 40, 1 To 40) As String, 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
Form1.Print "Алфавит"
For i = 1 To 26
 a(i) = Chr(i + 64) 'Int(Rnd * 26 + 65))
 Form1.Print a(i); " ";
 alf = alf + a(i)
Next
Form1.Print
Form1.Print "Исходный массив"
For i = 1 To m
 a(i) = Chr(Int(Rnd * 26 + 65))
 Form1.Print a(i); " ";
 
Next
fl(1) = True
fl(2) = 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) = Chr(Int(Rnd * 26 + 65))
  Form1.Print b(i, j); " ";
 Next
Form1.Print
Next
fl(2) = True
fl(1) = False

End Sub

Private Sub Command3_Click()
End
End Sub

Private Sub Command4_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 Command5_Click()
r = 0
alv = ""
For j = 1 To 26
alv = Mid(alf, j, 1)
 For i = 1 To m - 1
  If a(i) = alv Then
   r = r + 1
   aa(r) = a(i)
  End If
 Next
Next
Form1.Print
Form1.ForeColor = 555555
Form1.Print "Отсортированный массив"

For i = 1 To m
 Form1.Print aa(i); " ";
Next

End Sub

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

Min = InputBox("Введите символ")
Form1.Cls

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

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

Min = InputBox("Введите символ")
Form1.Cls

 c = 1
 kk = 1

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


End Sub

Private Sub Command7_Click()
Dim Now(1 To 1000) As String
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.ForeColor = 555555

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 form_Click()
If fl(3) = False Then
Form1.Cls
Pic1.Visible = True

fl(3) = True
Else
Pic1.Visible = False

fl(3) = False
End If


End Sub

Private Sub Form_Load()
Pic1.Visible = False
Text1.Visible = False

fo = Time
fl(3) = False
End Sub

Private Sub Form_Resize()
Command4.Top = ScaleHeight - 700
Command4.Left = ScaleWidth - 2650
Command5.Top = ScaleHeight - 4200
Command5.Left = ScaleWidth - 1300
Command1.Top = ScaleHeight - 3500
Command1.Left = ScaleWidth - 1300
Command6.Top = ScaleHeight - 2800
Command6.Left = ScaleWidth - 1300
Command7.Top = ScaleHeight - 2100
Command7.Left = ScaleWidth - 1300
Command2.Top = ScaleHeight - 1400
Command2.Left = ScaleWidth - 1300
Command3.Top = ScaleHeight - 700
Command3.Left = ScaleWidth - 1300

End Sub

Private Sub Pic1_Click()
If fl(3) = True Then

Text1.Visible = False

fl(3) = False
Else
Text1.Visible = True
fl(3) = True
End If

End Sub

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

End Sub
