|
I would like to ask: How does the variable qianwei in the following program play a role in judging? According to my level, I have never understood it. Sorry, ask you! Thank you!
function Tform1.SmallTOBig (small: real): string;
var SmallMonth, BigMonth: string;
wei1, qianwei1: string [2];
wei, qianwei, dianweizhi, qian: integer;
begin
qianwei: =-2;
Smallmonth: = formatfloat ('0.00', small);
dianweizhi: = pos ('.', Smallmonth); {position of decimal point}
for qian: = length (Smallmonth) downto 1 do
begin
{Continue if you read something other than a decimal point}
if qian <> dianweizhi then
begin
{Numbers in position are converted to uppercase}
case strtoint (copy (Smallmonth, qian, 1)) of
1: wei1: = 'One'; 2: wei1: = '贰';
3: wei1: = 'Three'; 4: wei1: = 'Three';
5: wei1: = '吴'; 6: wei1: = '陆';
7: wei1: = '柒'; 8: wei1: = '捌';
9: wei1: = '玖'; 0: wei1: = 'zero';
end;
{Judge the uppercase position, you can continue to increase to the maximum of the real type}
case qianwei of
-3: qianwei1: = 'cent';
-2: qianwei1: = 'minute';
-1: qianwei1: = 'Angle';
0: qianwei1: = 'yuan';
1: qianwei1: = 'pick up';
2: qianwei1: = '百';
3: qianwei1: = 'Thousands';
4: qianwei1: = '10,000';
5: qianwei1: = 'pick up';
6: qianwei1: = '百';
7: qianwei1: = 'Thousands';
8: qianwei1: = 'billion';
9: qianwei1: = 'ten';
10: qianwei1: = '百';
11: qianwei1: = 'Thousands';
end;
inc (qianwei);
BigMonth: = wei1 + qianwei1 + BigMonth; {Combined into capitals}
end;
end;
SmallTOBig: = BigMonth;
end; |
|