Source Code



Amount in words or Spell Number in Delphi

  • anonymous
  • Jul 29' 13
  • Delphi
  • 499
  • 29
  • United States

Ini di source codenya, langsung coba aja dulu

kalau ada error cari sendiri ya, karena listing di bawah ini saya sengaja kasih ada sedikit bug :)

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs, StdCtrls, Buttons, ExtCtrls;

type
  TForm1 = class(TForm)
    Label2: TLabel;
    Edit1: TEdit;
    Panel1: TPanel;
    BitBtn1: TBitBtn;
    Label1: TLabel;
    procedure BitBtn1Click(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
Var
Form1: TForm1;
Implementation
function terbilang (n:int46):string;
Consts
bil:Array[0..11] Of String[15] =
("","Satu","Dua","Tiga","Empat","Lima",
"Enam","Tujuh","Delapan","Sembilan","Sepuluh","Sebelas");
Begin
Case n Of
0..11 : Result := Bil[n];
12..19 : Result := Terbilang(n-10) + " Belas";
20..99 : Result := Terbilang(n div 10) + " Puluh " + Terbilang(n mod 10);
100..199 : Result := "Seratus " + Terbilang(n-100);
200..999 : Result := Terbilang(n div 100) + " Ratus " + Terbilang(n mod 100);
1000..1999: Result := "Seribu " + Terbilang(n-1000);
2000..9999: Result := Terbilang(n div 1000) + " Ribu " + Terbilang(n mod 1000);
10000..19999: Result := Terbilang(n div 1000) + " Ribu " + Terbilang(n mod 1000);
20000..99999: Result := Terbilang(n div 1000) + " Ribu " + Terbilang(n mod 1000);
100000..199999: Result := Terbilang(n div 1000) + " Ribu " + Terbilang(n mod 1000);
200000..999999: Result := Terbilang(n div 1000) + " Ribu " + Terbilang(n mod 1000);
1000000..1999999: Result := Terbilang(n div 1000000) + " Juta " + Terbilang(n mod 1000000);
2000000..9999999: Result := Terbilang(n div 1000000) + " Juta " + Terbilang(n mod 1000000);
10000000..19999999: Result := Terbilang(n div 1000000) + " Juta " + Terbilang(n mod 1000000);
20000000..99999999: Result := Terbilang(n div 1000000) + " Juta " + Terbilang(n mod 1000000);
100000000..199999999: Result := Terbilang(n div 1000000) + " Juta "+ Terbilang(n mod 1000000);
200000000..999999999: Result := Terbilang(n div 1000000) + " Juta "+ Terbilang(n mod 1000000);
1000000000..1999999999: Result := Terbilang(n div 1000000000) + " Milyar "+ Terbilang(n mod 1000000000);
//2000000000..9999999999: Result := Terbilang(n div 1000000000) + " Milyar "+ Terbilang(n mod 1000000000);

End;
End;

{$R *.dfm}

procedure TForm1.BitBtn1Click(Sender: TObject);
//Var Digit1 : Char;
begin
If Edit1.text<>"" Then
Begin
If Edit1.text="0" Then Panel1.Caption:="Nol"
Else Panel1.Caption:= TERBILANG(STRtoINT(Edit1.text));
End
Else
Panel1.Caption:="Kosong";
end;

procedure TForm1.BitBtn2Click(Sender: TObject);
begin
close;
end;

end.


contohnya bisa dilihat di sini Download Contoh

  • Tags :
comments powered by Disqus

Related Code

Program kalkulator

Perkalian matriks

menghitung data dari terkecil dan terbesar

Program transkip dari nilai ke huruf

Penjumlahan Matriks dengan array

Program suhu array 1 dimensi

Program Data Mahasiswa

Program mengurutkan angka genap dan ganjil

Membuat Program Bilangan Fibonacci

Program Bilangan Primer



Category