Private Sub Form_Load()Me.HideDim a As BooleanOpen App.Path & "\in.txt" For Input As #1Open App.Path & "\out.txt" For Output As #2Input #1, nFor co50 = 0 To 1 For co10 = 1 To 3 For co5 = 1 To 5 For co1 = 1 To 25 If co1 * 1 = n Then List1.AddItem "1 *" & co1 & "=" & co1 * 1 & "找0元" If co50 * 50 > n Then List1.AddItem "50 *" & co50 & "=" & co50 * 50 & "找回 " & co50 * 50 - n & "元" If co10 * 10 >= n And co10 * 10 <= n + 9 Then List1.AddItem "10 *" & co10 & "=" & co10 * 10 & "找回" & co10 * 10 - n & "元" If co5 * 5 >= n And co5 * 5 < n + 9 Then List1.AddItem "5 *" & co5 & "=" & co5 * 5 & "找回" & co5 * 5 - n & "元" If co10 * 10 + co5 * 5 + co1 * 1 >= n And co10 * 10 + co5 * 5 + co1 * 1 < n + 1 Then List1.AddItem "10 *" & co10 & "+ 5 * " & co5 & "+ 1 * " & co1 & "=" & co10 * 10 + co5 * 5 + co1 * 1 & "找回" & co10 * 10 + co5 * 5 + co1 * 1 - n & "元" If co10 * 10 + co5 * 5 >= n And co10 * 10 + co5 * 5 <= n + 4 Then List1.AddItem "10 *" & co10 & "+ 5 * " & co5 & "=" & co10 * 10 + co5 * 5 & "找回" & co10 * 10 + co5 * 5 - n & "元" If co10 * 10 + co1 * 1 >= n And co10 * 10 + co1 * 1 < n + 1 Then List1.AddItem "10 *" & co10 & "+ 1 * " & co1 & "=" & co10 * 10 + co1 * 1 & "找回" & co10 * 10 + co1 * 1 - n & "元" If co5 * 5 + co1 * 1 >= n And co5 * 5 + co1 * 1 < n + 1 Then List1.AddItem "5 *" & co5 & "+ 1 * " & co1 & "=" & co5 * 5 + co1 * 1 & "找回" & co5 * 5 + co1 * 1 - n & "元" Next Next NextNextFor k = 1 To 50For i = 0 To List1.ListCount For j = i + 1 To List1.ListCount If List1.List(i) = List1.List(j) Then List1.RemoveItem (i) NextNextNextFor i = 0 To List1.ListCountPrint #2, List1.List(i)NextCloseCloseEndEnd Sub
Private Sub Form_Load()
回覆刪除Me.Hide
Dim a As Boolean
Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
Input #1, n
For co50 = 0 To 1
For co10 = 1 To 3
For co5 = 1 To 5
For co1 = 1 To 25
If co1 * 1 = n Then List1.AddItem "1 *" & co1 & "=" & co1 * 1 & "找0元"
If co50 * 50 > n Then List1.AddItem "50 *" & co50 & "=" & co50 * 50 & "找回 " & co50 * 50 - n & "元"
If co10 * 10 >= n And co10 * 10 <= n + 9 Then List1.AddItem "10 *" & co10 & "=" & co10 * 10 & "找回" & co10 * 10 - n & "元"
If co5 * 5 >= n And co5 * 5 < n + 9 Then List1.AddItem "5 *" & co5 & "=" & co5 * 5 & "找回" & co5 * 5 - n & "元"
If co10 * 10 + co5 * 5 + co1 * 1 >= n And co10 * 10 + co5 * 5 + co1 * 1 < n + 1 Then List1.AddItem "10 *" & co10 & "+ 5 * " & co5 & "+ 1 * " & co1 & "=" & co10 * 10 + co5 * 5 + co1 * 1 & "找回" & co10 * 10 + co5 * 5 + co1 * 1 - n & "元"
If co10 * 10 + co5 * 5 >= n And co10 * 10 + co5 * 5 <= n + 4 Then List1.AddItem "10 *" & co10 & "+ 5 * " & co5 & "=" & co10 * 10 + co5 * 5 & "找回" & co10 * 10 + co5 * 5 - n & "元"
If co10 * 10 + co1 * 1 >= n And co10 * 10 + co1 * 1 < n + 1 Then List1.AddItem "10 *" & co10 & "+ 1 * " & co1 & "=" & co10 * 10 + co1 * 1 & "找回" & co10 * 10 + co1 * 1 - n & "元"
If co5 * 5 + co1 * 1 >= n And co5 * 5 + co1 * 1 < n + 1 Then List1.AddItem "5 *" & co5 & "+ 1 * " & co1 & "=" & co5 * 5 + co1 * 1 & "找回" & co5 * 5 + co1 * 1 - n & "元"
Next
Next
Next
Next
For k = 1 To 50
For i = 0 To List1.ListCount
For j = i + 1 To List1.ListCount
If List1.List(i) = List1.List(j) Then List1.RemoveItem (i)
Next
Next
Next
For i = 0 To List1.ListCount
Print #2, List1.List(i)
Next
Close
Close
End
End Sub