如何用vfp编写程序文件 EX3_1.PRG
如何用vfp编写程序文件EX3_1.PRG,其程序的功能是接收键盘上输入的货币类型的数据,按中式财务大写输出.例如:$654321.78(vfp货币格式)-陆拾五万肆千叁...
如何用vfp编写程序文件 EX3_1.PRG,其程序的功能是接收键盘上输入的货币类型的数据,按中式财务大写输出.例如:
$654321.78(vfp货币格式) - 陆拾五万肆千叁佰贰拾壹圆柒角捌分(中式货币格式) 展开
$654321.78(vfp货币格式) - 陆拾五万肆千叁佰贰拾壹圆柒角捌分(中式货币格式) 展开
展开全部
function moneychange
parameters lnmoney
lnnumber = lnmoney
chinamoney = ""
dime chinano(10)
chinano(1) = "零"
chinano(2) = "壹"
chinano(3) = "贰"
chinano(4) = "叁"
chinano(5) = "肆"
chinano(6) = "伍"
chinano(7) = "陆"
chinano(8) = "柒"
chinano(9) = "捌"
chinano(10) = "玖"
dime cdw(2)
cdw(1)="角"
cdw(2)="分"
dime chinanum(10)
chinanum(1) = "元"
chinanum(2) = "拾"
chinanum(3) = "佰"
chinanum(4) = "仟"
chinanum(5) = "万"
chinanum(6) = "拾"
chinanum(7) = "佰"
chinanum(8) = "仟"
chinanum(9) = "亿"
chinanum(10) = "拾"
lnintnumber = int(lnnumber)
lcintnumber = alltrim(str(lnintnumber,10,0))
lndicnumber = int((lnnumber-lnintnumber)*100)
lcdicnumber = iif(!empty(lndicnumber),str(lndicnumber,2,0),"")
n = 1
for i = len(lcintnumber) to 1 step -1
for j = 1 to 10
if val(subst(lcintnumber,i,1)) = j-1
chinamoney = chinano(j)+chinanum(n)+chinamoney
n = n+1
exit
endif
endfor
endfor
if !empty(lcdicnumber)
for z = 1 to 2
for p = 1 to 10
if val(subst(lcdicnumber,z,1)) = p-1
chinamoney = chinamoney+chinano(p)+cdw(z)
exit
endif
endfor
endfor
else
chinamoney=chinamoney+"整"
endif
return chinamoney
parameters lnmoney
lnnumber = lnmoney
chinamoney = ""
dime chinano(10)
chinano(1) = "零"
chinano(2) = "壹"
chinano(3) = "贰"
chinano(4) = "叁"
chinano(5) = "肆"
chinano(6) = "伍"
chinano(7) = "陆"
chinano(8) = "柒"
chinano(9) = "捌"
chinano(10) = "玖"
dime cdw(2)
cdw(1)="角"
cdw(2)="分"
dime chinanum(10)
chinanum(1) = "元"
chinanum(2) = "拾"
chinanum(3) = "佰"
chinanum(4) = "仟"
chinanum(5) = "万"
chinanum(6) = "拾"
chinanum(7) = "佰"
chinanum(8) = "仟"
chinanum(9) = "亿"
chinanum(10) = "拾"
lnintnumber = int(lnnumber)
lcintnumber = alltrim(str(lnintnumber,10,0))
lndicnumber = int((lnnumber-lnintnumber)*100)
lcdicnumber = iif(!empty(lndicnumber),str(lndicnumber,2,0),"")
n = 1
for i = len(lcintnumber) to 1 step -1
for j = 1 to 10
if val(subst(lcintnumber,i,1)) = j-1
chinamoney = chinano(j)+chinanum(n)+chinamoney
n = n+1
exit
endif
endfor
endfor
if !empty(lcdicnumber)
for z = 1 to 2
for p = 1 to 10
if val(subst(lcdicnumber,z,1)) = p-1
chinamoney = chinamoney+chinano(p)+cdw(z)
exit
endif
endfor
endfor
else
chinamoney=chinamoney+"整"
endif
return chinamoney
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询