VB急用,设某职工应发工资X元,试求各种钞票总张数最少的付款方案

来源:百度知道 编辑:UC知道 时间:2024/06/15 21:49:27
各种钞票

www.csdn.net
对你会有帮助的

If Text1.Text = "" Then Exit Sub
temp = Text1.Text
temp2 = temp \ 100 '百元有几张

If temp2 <> 0 Then out = "100元有" & temp2 & "张" & Chr(13) '如果不为0

temp = temp Mod 100 '除100取余
temp2 = temp \ 50 '50元有几张
If temp2 <> 0 Then out = out & "50元有" & temp2 & "张" & Chr(13)

temp = temp Mod 50 '除50取余
temp2 = temp \ 20 '20元有几张
If temp2 <> 0 Then out = out & "20元有" & temp2 & "张" & Chr(13)

temp = temp Mod 20 '除20取余
temp2 = temp \ 10 '10元有几张
If temp2 <> 0 Then out = out & "10元有" & temp2 & "张" & Chr(13)

temp = temp Mod 10 '除10取余
temp2 = temp \ 5 '5元有几张
If temp2 <> 0 Then out = out & "5元有" & temp2 & "张"