Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit Unit1;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, StdCtrls, ExtCtrls;
- type
- TForm1 = class(TForm)
- ListBox1: TListBox;
- Button1: TButton;
- ListBox2: TListBox;
- ListBox3: TListBox;
- ListBox4: TListBox;
- Label1: TLabel;
- Label2: TLabel;
- Edit1: TEdit;
- Edit2: TEdit;
- Label3: TLabel;
- Bevel1: TBevel;
- Label5: TLabel;
- Label4: TLabel;
- Edit3: TEdit;
- procedure Button1Click(Sender: TObject);
- procedure FormShow(Sender: TObject);
- private
- { Private declarations }
- procedure bersih;
- public
- { Public declarations }
- end;
- var
- Form1: TForm1;
- implementation
- uses StrUtils;
- {$R *.dfm}
- procedure TForm1.bersih;
- begin
- Edit1.Clear;
- Edit2.Clear;
- Edit3.Clear;
- Label5.Caption:='';
- end;
- procedure TForm1.Button1Click(Sender: TObject);
- var
- i, i2 : Byte;
- hasil : Int64;
- hasil2 : Integer;
- a,b, teks, proses, prosesangka : string;
- begin
- if Button1.Caption='Proses' then begin
- for i := 1 to 9 do begin
- a:=a+inttostr(i);
- hasil:= strtoint(a)* 8 + i;
- ListBox1.Items.Add(a + ' x 8 + '+ inttostr(i) + ' = '+ FloatToStr(hasil) );
- end; // for i := 1 to 9 do begin
- i := 0;
- hasil := 0;
- a:='';
- b:='';
- for i := 1 to 9 do begin
- a:=a+inttostr(i);
- hasil:= strtoint(a)* 9 + (i+1);
- ListBox2.Items.Add(a + ' x 9 + '+ IntToStr(i+1) + ' = '+ FloatToStr(hasil) );
- end; // end for i := 1 to 9 do begin
- i := 0;
- hasil := 0;
- a:='';
- b:='';
- for i := 9 Downto 2 do begin
- a:=a+inttostr(i);
- hasil:= strtoint(a)* 9 + (i-2);
- ListBox3.Items.Add(a + ' x 9 + '+ IntToStr(i-2) + ' = '+ FloatToStr(hasil) );
- end; // end for i := 9 Downto 2 do begin
- i := 0;
- hasil := 0;
- a:='';
- b:='';
- for i := 1 to 9 do begin
- a:=a+IntToStr(1);
- hasil:= StrToInt64(a)* StrToInt64(a) ;
- ListBox4.Items.Add(a + ' x '+ a + ' = '+ IntToStr(hasil) );
- end; // end for i := 1 to 9 do begin
- //Dibawah untuk menampilkan proses angka huruf serta hasil penjumlahannya
- teks := Edit1.Text;
- hasil2 := 0;
- for i2 := 1 to Length(teks) do begin
- if (teks[i2]>='A') and (teks[i2]<='Z') then Begin
- hasil2 := hasil2 + Ord(teks[i2]) - 64;
- Label5.Caption := IntToStr(hasil2) + ' %';
- //Logical Proses huruf
- if i2 < length(teks) then proses:=proses + teks[i2]+ ' + '
- else proses:=proses + teks[i2];
- //Logical Proses Angka
- if i2 < length(teks) then prosesangka:=prosesangka + IntToStr(Ord(teks[i2])-64)+ ' + '
- else prosesangka:=prosesangka + IntToStr(Ord(teks[i2])-64);
- end; // if (teks[i2]>='A') and (teks[i2]<='Z') then Begin
- end; //end for i2 := 1 to Length(teks) do begin
- Edit2.text:=proses;
- Edit3.Text:=prosesangka;
- Button1.Caption:='Ulangi';
- end
- else if Button1.Caption='Ulangi' then begin
- Button1.Caption:='Proses';
- ListBox1.Clear;
- ListBox2.Clear;
- ListBox3.Clear;
- ListBox4.Clear;
- Bersih;
- eDIT1.SetFocus;
- end;//end else
- end;
- procedure TForm1.FormShow(Sender: TObject);
- begin
- bersih;
- Edit1.SetFocus;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement