这个的代码怎么写?应发工资X元,求各种票额钞票总张数最少的付款方案!
1个回答
展开全部
'控件太多,直接给你写个测试例,用随机数作为工资 1000-9999元
Private Sub Form_Click()
Dim n, i, arr, brr(5)
Cls
arr = Split("100 50 20 10 5 1")
Randomize
n = Int(Rnd * 9000) + 1000
Print "工资:" & n
For i = 0 To 4
brr(i) = n \ Val(arr(i))
n = n - Val(brr(i)) * Val(arr(i))
Next
brr(5) = n
For i = 0 To 5
Print arr(i) & ":"; brr(i)
Next
End Sub
Private Sub Form_Click()
Dim n, i, arr, brr(5)
Cls
arr = Split("100 50 20 10 5 1")
Randomize
n = Int(Rnd * 9000) + 1000
Print "工资:" & n
For i = 0 To 4
brr(i) = n \ Val(arr(i))
n = n - Val(brr(i)) * Val(arr(i))
Next
brr(5) = n
For i = 0 To 5
Print arr(i) & ":"; brr(i)
Next
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询