W
web_lance
Unregistered / Unconfirmed
GUEST, unregistred user!
例如:
function NumToRMB(Num: Real;
CutZero: Boolean): ShortString;
const
RMB = '零壹贰叁肆伍陆柒捌玖分角元拾佰仟万拾佰仟亿';
var
Spot: ShortString;
I: Integer;
begin
Result := '';
Spot := IntToStr(Round(Num * 100));
if CutZero then
begin
???
end
else
begin
for I := Length(Spot)do
wnto 1do
begin
Result := Result + RMB[(StrToInt(Spot[Length(Spot) - I + 1]) + 1) * 2 - 1]
+ RMB[(StrToInt(Spot[Length(Spot) - I + 1]) + 1) * 2]
+ RMB[(10 + I) * 2 - 1] + RMB[(10 + I) * 2];
end;
end;
end;
输出:80000120.00 → 捌仟零佰零拾零万零仟壹佰贰拾零元零角零分 → 捌仟万零壹佰贰拾元
就如何用比较精简的语句实现题意,请各位大富翁各抒己见!
(请贴出源代码或E-mail至weblance@163.com,请注明标题。经过对比,语句最精简者独得分数)
function NumToRMB(Num: Real;
CutZero: Boolean): ShortString;
const
RMB = '零壹贰叁肆伍陆柒捌玖分角元拾佰仟万拾佰仟亿';
var
Spot: ShortString;
I: Integer;
begin
Result := '';
Spot := IntToStr(Round(Num * 100));
if CutZero then
begin
???
end
else
begin
for I := Length(Spot)do
wnto 1do
begin
Result := Result + RMB[(StrToInt(Spot[Length(Spot) - I + 1]) + 1) * 2 - 1]
+ RMB[(StrToInt(Spot[Length(Spot) - I + 1]) + 1) * 2]
+ RMB[(10 + I) * 2 - 1] + RMB[(10 + I) * 2];
end;
end;
end;
输出:80000120.00 → 捌仟零佰零拾零万零仟壹佰贰拾零元零角零分 → 捌仟万零壹佰贰拾元
就如何用比较精简的语句实现题意,请各位大富翁各抒己见!
(请贴出源代码或E-mail至weblance@163.com,请注明标题。经过对比,语句最精简者独得分数)