📄 字典序法.frm
字号:
VERSION 5.00
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
Begin VB.Form Form1
Caption = "组合数学--字典序法"
ClientHeight = 1830
ClientLeft = 60
ClientTop = 345
ClientWidth = 4830
Icon = "字典序法.frx":0000
LinkTopic = "Form1"
ScaleHeight = 1830
ScaleWidth = 4830
StartUpPosition = 3 '窗口缺省
Begin ComctlLib.StatusBar StatusBar1
Align = 2 'Align Bottom
Height = 375
Left = 0
TabIndex = 6
Top = 1455
Width = 4830
_ExtentX = 8520
_ExtentY = 661
Style = 1
SimpleText = ""
_Version = 327682
BeginProperty Panels {0713E89E-850A-101B-AFC0-4210102A8DA7}
NumPanels = 1
BeginProperty Panel1 {0713E89F-850A-101B-AFC0-4210102A8DA7}
TextSave = ""
Key = ""
Object.Tag = ""
EndProperty
EndProperty
End
Begin VB.CommandButton Command2
Caption = "清空"
Height = 255
Left = 3720
TabIndex = 3
Top = 840
Width = 855
End
Begin VB.CommandButton Command1
Caption = "开始"
Height = 255
Left = 3720
TabIndex = 2
Top = 360
Width = 855
End
Begin VB.TextBox Text2
Height = 375
Left = 1440
TabIndex = 1
Top = 840
Width = 2055
End
Begin VB.TextBox Text1
Height = 375
Left = 1440
TabIndex = 0
Top = 240
Width = 2055
End
Begin VB.Label Label2
Caption = "生成排列:"
Height = 255
Left = 240
TabIndex = 5
Top = 960
Width = 975
End
Begin VB.Label Label1
Caption = "初始排列:"
Height = 255
Left = 240
TabIndex = 4
Top = 360
Width = 975
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim A(4) As Integer
Private Sub Command1_Click()
Dim inputstring As String
Dim j, i, k As Integer
Dim maxk, maxj As Integer
Dim tempdata As Integer
maxk = 0
maxj = 0
A(0) = 0
'define data
inputstring = Text1.Text
'input data
For i = 1 To 4
A(i) = Val(Mid(inputstring, i, 1))
Next
'test data
StatusBar1.SimpleText = "过程:"
StatusBar1.SimpleText = StatusBar1.SimpleText & A(1) & A(2) & A(3) & A(4)
'compare data
's1
For j = 1 To 4
If A(j - 1) < A(j) Then
If maxj < j Then
maxj = j
End If
End If
Next
StatusBar1.SimpleText = StatusBar1.SimpleText & " " & "i=" & maxj
's2
For k = 1 To 4
If A(maxj - 1) < A(k) Then
If maxk < k Then
maxk = k
End If
End If
Next
StatusBar1.SimpleText = StatusBar1.SimpleText & " " & "j=" & maxk
'exchange data
tempdata = A(maxj - 1)
A(maxj - 1) = A(maxk)
A(maxk) = tempdata
'test data
StatusBar1.SimpleText = StatusBar1.SimpleText & " " & "互换:" & A(1) & A(2) & A(3) & A(4)
'invert Data
inputstring = ""
For i = maxj To 4
inputstring = inputstring & A(i)
Next
inputstring = StrReverse(inputstring)
StatusBar1.SimpleText = StatusBar1.SimpleText & " " & "逆转:" & inputstring
Text2.Text = ""
For j = 1 To maxj - 1
Text2.Text = Text2.Text & A(j)
Next
Text2.Text = Text2.Text & inputstring
'test data
StatusBar1.SimpleText = StatusBar1.SimpleText & " " & "结果:" & Text2.Text
End Sub
Private Sub Command2_Click()
Text1.Text = ""
StatusBar1.SimpleText = ""
Text2.Text = ""
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -