unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
function Amount(N: Longint): String;
const
Units: array[0..9] of String = ('', 'ÀÏ', 'ÀÌ', '»ï', '»ç', '¿À',
'À°', 'Ä¥', 'ÆÈ', '±¸');
Lower: array[0..3] of String = ('', '½Ê','¹é','õ');
Higher: array[0..4] of String = ('', '¸¸','¾ï','Á¶','°æ');
HighLevel: Integer = 0;
begin
case N of
0..9: Result := Result + Units[N];
10..99:
Result := Result +
Amount(N div 10) + Lower[1] + Amount(N mod 10);
100..999:
Result := Result +
Amount(N div 100) + Lower[2] + Amount(N mod 100);
1000..9999:
Result := Result +
Amount(N div 1000) + Lower[3] + Amount(N mod 1000);
else
begin
inc(HighLevel);
Result := Result +
Amount(N div 10000) + Higher[HighLevel] + Amount(N mod 10000);
dec(HighLevel);
end;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
try
Label1.caption := Amount(Trunc(StrToFloat(Edit1.Text)));
except
on EConvertError do
Label1.caption := 'Á¤È®ÇÑ ¼ýÀÚ¸¦ ÀÔ·ÂÇϼ¼¿ä';
end;
end;
end. |
|