VERSION 5.00 Object = "{FE0065C0-1B7B-11CF-9D53-00AA003C9CB6}#1.1#0"; "COMCT232.OCX" Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX" Begin VB.Form Form4 BorderStyle = 3 'Fixed Dialog Caption = "Запись в файл" ClientHeight = 3090 ClientLeft = 6450 ClientTop = 4560 ClientWidth = 4680 LinkTopic = "Form4" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 3090 ScaleWidth = 4680 ShowInTaskbar = 0 'False Begin VB.TextBox txtTop Height = 375 Left = 1080 TabIndex = 5 Text = "550" Top = 240 Width = 600 End Begin VB.CommandButton cmdBack3 Caption = "Назад" Height = 375 Left = 1320 TabIndex = 4 Top = 2400 Width = 2055 End Begin VB.CommandButton cmdFile2 Caption = "Начать процесс" Default = -1 'True Height = 375 Left = 1320 TabIndex = 0 Top = 1920 Width = 2055 End Begin MSComctlLib.ProgressBar ProgressBar1 Height = 495 Left = 120 TabIndex = 1 Tag = "ljb" Top = 960 Width = 3735 _ExtentX = 6588 _ExtentY = 873 _Version = 393216 BorderStyle = 1 Appearance = 1 Min = 5 Max = 50 End Begin ComCtl2.UpDown UpDown1 Height = 375 Left = 1680 TabIndex = 6 Top = 240 Width = 255 _ExtentX = 423 _ExtentY = 661 _Version = 327681 Value = 550 BuddyControl = "txtTop" BuddyDispid = 196609 OrigLeft = 1560 OrigTop = 240 OrigRight = 1815 OrigBottom = 615 Increment = 50 Max = 5000 Min = 550 SyncBuddy = -1 'True BuddyProperty = 65547 Enabled = -1 'True End Begin VB.Label Label1 Caption = "От 500 до ..." Height = 255 Left = 120 TabIndex = 3 Top = 240 Width = 1695 End Begin VB.Label lblOk Height = 255 Left = 3960 TabIndex = 2 Top = 1080 Width = 615 End End Attribute VB_Name = "Form4" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Sub cmdBack3_Click() Form1.Show Form4.Visible = False End Sub Private Sub cmdFile2_Click() Open "Массив.txt" For Output As 1 k = Val(txtTop.Text) If k > 5000 Then k = 5000 If k < 550 Then k = 550 txtTop.Text = Str(k) ProgressBar1.Max = k / 100 For n1 = 500 To k Step 50 n = n1 ReDim Arr(n) For x = 0 To n Arr(x) = Int(Rnd(9) * 10) Next tim = Timer For x = 0 To n - 1 For y = 0 To n - 1 If Arr(y) < Arr(y + 1) Then a = Arr(y) Arr(y) = Arr(y + 1) Arr(y + 1) = a End If Next Next tim = Timer - tim t1 = Str(Int(tim)) t2 = Format(tim, "0.0000") t3 = Right(t2, 4) t1 = t1 + t3 Write #1, Str(n) Write #1, t1 tim = Timer n = n g = (n + 1) \ 2 Do I = g Do J = I - g C = True Do If Arr(J) >= Arr(J + g) Then C = False Else Tmp = Arr(J) Arr(J) = Arr(J + g) Arr(J + g) = Tmp End If J = J - 1 Loop While (J >= 0 And C) I = I + 1 Loop While I <= n g = g \ 2 Loop While g > 0 tim = Timer - tim t1 = Str(Int(tim)) t2 = Format(tim, "0.0000") t3 = Right(t2, 4) t1 = t1 + t3 Write #1, Str(n + 1) Write #1, t1 ProgressBar1.Value = n1 / 100 Next lblOk = "Ok" Beep Close 1 End Sub