?? 背包問題.txt
字號:
Dim a1 As Integer
Dim a2 As Integer
Dim a3 As Integer
Dim a4 As Integer
Dim a5 As Integer
Dim a6 As Integer
Dim a7 As Integer
Dim a8 As Integer
Dim a9 As Integer
Dim a10 As Integer
Dim a11 As Integer
Dim a12 As Integer
Private Sub Cmd_step_Click()
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Me.Text_TLE.Enabled = False
List1.AddItem "第一輪開始"
a1 = Val(Text1.Text) + Val(Text2.Text)
List1.AddItem Text1.Text & "+" & Text2.Text & "=" & a1
a2 = a1 + Val(Text3.Text)
If a1 + Val(Text3.Text) = Val(Me.Text_TLE.Text) Then
List1.AddItem a1 & "+" & Text3.Text & "=" & Text_TLE.Text
MsgBox "滿足要求,演示結束"
Else
List1.AddItem a1 & "+" & Text3.Text & "=" & a2
MsgBox "不滿足要求,繼續下組數據"
End If
a3 = a1 + Val(Text4.Text)
If a1 + Val(Text4.Text) = Val(Me.Text_TLE.Text) Then
List1.AddItem a1 & "+" & Text4.Text & "=" & Text_TLE.Text
MsgBox "滿足要求,演示結束"
Else
List1.AddItem a1 & "+" & Text4.Text & "=" & a3
MsgBox "不滿足要求,繼續下組數據"
End If
a4 = a1 + Val(Text5.Text)
If a1 + Val(Text5.Text) = Val(Me.Text_TLE.Text) Then
List1.AddItem a1 & "+" & Text5.Text & "=" & Text_TLE.Text
MsgBox "滿足要求,演示結束"
Else
List1.AddItem a1 & "+" & Text5.Text & "=" & a4
MsgBox "此組數據均不滿足要求,繼續下一輪數據"
End If
List1.AddItem "第二輪開始"
a5 = Val(Text1.Text) + Val(Text3.Text)
List1.AddItem Text1.Text & "+" & Text3.Text & "=" & a5
a6 = a5 + Val(Text4.Text)
If a5 + Val(Text4.Text) = Val(Me.Text_TLE.Text) Then
List1.AddItem a5 & "+" & Text4.Text & "=" & Text_TLE.Text
MsgBox "滿足要求,演示結束"
Else
List1.AddItem a5 & "+" & Text4.Text & "=" & a6
MsgBox "不滿足要求,繼續下組數據"
End If
a7 = a5 + Val(Text5.Text)
If a5 + Val(Text5.Text) = Val(Me.Text_TLE.Text) Then
List1.AddItem a5 & "+" & Text5.Text & "=" & Text_TLE.Text
MsgBox "滿足要求,演示結束"
Else
List1.AddItem a5 & "+" & Text5.Text & "=" & a7
MsgBox "此組數據均不滿足要求,繼續下一輪數據"
End If
List1.AddItem "第三輪開始"
a8 = Val(Text2.Text) + Val(Text3.Text)
List1.AddItem Text2.Text & "+" & Text3.Text & "=" & a8
a9 = a8 + Val(Text4.Text)
If a8 + Val(Text4.Text) = Val(Me.Text_TLE.Text) Then
List1.AddItem a8 & "+" & Text4.Text & "=" & Text_TLE.Text
MsgBox "滿足要求,演示結束"
Else
List1.AddItem a8 & "+" & Text4.Text & "=" & a9
MsgBox "不滿足要求,繼續下組數據"
End If
a10 = a8 + Val(Text5.Text)
If a8 + Val(Text5.Text) = Val(Me.Text_TLE.Text) Then
List1.AddItem a8 & "+" & Text5.Text & "=" & Text_TLE.Text
MsgBox "滿足要求,演示結束"
Else
List1.AddItem a8 & "+" & Text5.Text & "=" & a10
MsgBox "此組數據均不滿足要求,繼續下一輪數據"
End If
List1.AddItem "第四輪開始"
a11 = Val(Text3.Text) + Val(Text4.Text)
List1.AddItem Text3.Text & "+" & Text4.Text & "=" & a11
a12 = a11 + Val(Text5.Text)
If a11 + Val(Text5.Text) = Val(Me.Text_TLE.Text) Then
List1.AddItem a11 & "+" & Text5.Text & "=" & Text_TLE.Text
MsgBox "滿足要求,演示結束"
Else
List1.AddItem a11 & "+" & Text5.Text & "=" & a12
MsgBox "所有數據均不符合要求,請重新輸入"
End If
Text1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
Text5.Enabled = True
Me.Text_TLE.Enabled = True
End Sub
Private Sub Command3_Click()
End
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -