帮帮忙 谢谢了 ~!!!~!
打出一串数字 用大写读出来
例如: 6 4015 1454.12元
六亿肆千零拾伍万壹千肆佰伍拾肆元壹角贰分
谢谢了 !~!~!~!~1
[解决办法]
String GetRmbDx(float f)
{
int f1,w,q,b,s,y,j,fen;
String ww,qq,bb,ss,yy,jj,ff;
//f1 = int(f*100);
f1 = f*100;
//万
w = int(f1/1000000);
ww = getBigNum(w)+ "万 ";
q = f1%1000000;
q = int(q/100000);
qq = getBigNum(q)+ "仟 ";
b = f1%100000;
b = int(b/10000);
bb = getBigNum(b)+ "佰 ";
s = f1%10000;
s = int(s/1000);
ss = getBigNum(s)+ "拾 ";
y = f1%1000;
y = int(y/100);
yy = getBigNum(y)+ "元 ";
j = f1%100;
j = int(j/10);
jj = getBigNum(j)+ "角 ";
fen = f1%10;
fen = int(fen);
ff = getBigNum(fen)+ "分 ";
return ww+qq+bb+ss+yy+jj+ff;
}
String getBigNum(int num)
{
String result;
switch(num)
{
case 0:
result = "零 ";
break;
case 1:
result = "壹 ";
break;
case 2:
result = "贰 ";
break;
case 3:
result = "叁 ";
break;
case 4:
result = "肆 ";
break;
case 5:
result = "伍 ";
break;
case 6:
result = "陆 ";
break;
case 7:
result = "柒 ";
break;
case 8:
result = "捌 ";
break;
case 9:
result = "玖 ";
break;
case 10:
result = "拾 ";
break;
default:
result = IntToStr(num);
}
return result;
}