Private Sub Form_Click() Dim d As String, l As Long, i As Long, a As Long, b As Integer, dc As Boolean a0 = 0: a1 = 0: a2 = 0: a3 = 0: a4 = 0: a5 = 0 Open App.Path & ("\全部场景.dat") For Random As #1 Len = 22 '打开“全部场景”文件。 For l = 1 To 338700 Get #1, l, d '......取出一个场景数据
b = 0 For i = 1 To 20 '......统计 20 个字符中有多少个 “3” If Mid$(d, i, 1) = "3" Then b = b + 1 Next i
Select Case b '......分别存入到各个文件里去 Case Is = 0 a0 = a0 + 1: Text1(0).Text = a0 Open App.Path & "\无横场景.dat" For Random As #2 Len = 22 Put #2, a0, d Close #2 Case Is = 2 a1 = a1 + 1: Text1(1).Text = a1 Open App.Path & "\一横场景.dat" For Random As #2 Len = 22 Put #2, a1, d Close #2 Case Is = 4 a2 = a2 + 1: Text1(2).Text = a2 Open App.Path & "\二横场景.dat" For Random As #2 Len = 22 Put #2, a2, d Close #2 Case Is = 6 a3 = a3 + 1: Text1(3).Text = a3 Open App.Path & "\三横场景.dat" For Random As #2 Len = 22 Put #2, a3, d Close #2 Case Is = 8 a4 = a4 + 1: Text1(4).Text = a4 Open App.Path & "\四横场景.dat" For Random As #2 Len = 22 Put #2, a4, d Close #2 Case Is = 10 a5 = a5 + 1: Text1(1).Text = a5 Open App.Path & "\五横场景.dat" For Random As #2 Len = 22 Put #2, a5, d Close #2 End Select Next l Close #1 Text2.Text = "End" '......当任务完成时,通知 End Sub
|