for li_loop = 1 to 7
if ll_big <=0 then exit
ll_big_count[li_loop] = long( ll_moneyrest / li_big_part[li_loop] )
ll_moneyrest = mod(ll_moneyrest, li_big_part[li_loop])
next
ll_moneyrest = li_small // 初始化余值
// 执行循环,找出小数部分的对应币种的张数
for li_loop = 1 to 6
if li_small <=0 then exit
li_small_count[li_loop] = int( ll_moneyrest / li_small_part[li_loop] )
ll_moneyrest = mod(ll_moneyrest, li_small_part[li_loop])
next
// 将整数部分的所有结果存放于 ls_result1
for li_loop = 1 to 7 step 1
if ll_big_count[li_loop] = 0 then continue
ls_result1 = ls_result1 + string(li_big_part[li_loop]) + &
"元=" + string(ll_big_count[li_loop]) + "张 "
next
// 将小数部分的所有结果存放于 ls_result2
for li_loop = 1 to 6 step 1
if li_small_count[li_loop] = 0 then continue
if li_loop < 4 then
ls_result2 = ls_result2 + string(li_small_part[li_loop]/10) + &
"角=" + string(li_small_count[li_loop]) + "张 "
else
ls_result2 = ls_result2 + string(li_small_part[li_loop]) + &
"分=" + string(li_small_count[li_loop]) + "张 "
end if
next
double ldc_cash[] = {100,50,20,10,5,2,1,0.5,0.1} //钱的面值
int li_return[] //钱币数量
int li_rd //
double ldc_value = 589.5 //金额
for li_rd = 1 to UpperBound(ldc_cash)
if ldc_value >= ldc_cash[li_rd] then
li_return[li_rd] = ldc_value / ldc_cash[li_rd]
ldc_value = ldc_value - (li_return[li_rd] *ldc_cash[li_rd])
else
li_return[li_rd] = 0
end if
end for