Rabu, 30 Januari 2019

SHORT CODE Membuat Kakulator Menggunakan Delphi7 LENGKAP DENGAN VIDIO





unit Kakulator_v;

interface

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

type
  TKakulator = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Edit1: TEdit;
    Memo1: TMemo;
    Timer1: TTimer;
    Label5: TLabel;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    Button5: TButton;
    Button6: TButton;
    Button7: TButton;
    Button8: TButton;
    Button9: TButton;
    Button10: TButton;
    Button11: TButton;
    Button12: TButton;
    Button13: TButton;
    Button14: TButton;
    Button15: TButton;
    Button16: TButton;
    Button17: TButton;
    Button18: TButton;
    Button19: TButton;
    Button20: TButton;
    Button21: TButton;
    Button22: TButton;
    Button23: TButton;
    Button24: TButton;
    Button25: TButton;
    Button26: TButton;
    Button27: TButton;
    Button28: TButton;
    Button29: TButton;
    Button30: TButton;
    Button31: TButton;
    Button32: TButton;
    Button33: TButton;
    sSkinManager1: TsSkinManager;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button8Click(Sender: TObject);
    procedure Button7Click(Sender: TObject);
    procedure Button6Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure Button9Click(Sender: TObject);
    procedure Button10Click(Sender: TObject);
    procedure Button11Click(Sender: TObject);
    procedure Button12Click(Sender: TObject);
    procedure Button16Click(Sender: TObject);
    procedure Button15Click(Sender: TObject);
    procedure Button14Click(Sender: TObject);
    procedure Button13Click(Sender: TObject);
    procedure Button17Click(Sender: TObject);
    procedure Button20Click(Sender: TObject);
    procedure Button19Click(Sender: TObject);
    procedure Button18Click(Sender: TObject);
    procedure Button24Click(Sender: TObject);
    procedure Button23Click(Sender: TObject);
    procedure Button22Click(Sender: TObject);
    procedure Button21Click(Sender: TObject);
    procedure Button28Click(Sender: TObject);
    procedure Button27Click(Sender: TObject);
    procedure Button26Click(Sender: TObject);
    procedure Button25Click(Sender: TObject);
    procedure Button32Click(Sender: TObject);
    procedure Button31Click(Sender: TObject);
    procedure Button30Click(Sender: TObject);
    procedure Button29Click(Sender: TObject);
    procedure Button33Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Kakulator: TKakulator;
  STR:string;
  BTN:integer;
  a,b,kode:integer;

implementation

uses Math;

{$R *.dfm}

procedure TKakulator.Button1Click(Sender: TObject);
begin
STR:=Edit1.Text;
Edit1.Text:='';
Label4.Caption:=' + ';
BTN:=1;
end;

procedure TKakulator.Button2Click(Sender: TObject);
begin
STR:=Edit1.Text;
Edit1.Text:='';
Label4.Caption:=' - ';
BTN:=2;
end;

procedure TKakulator.Button3Click(Sender: TObject);
begin
STR:=Edit1.Text;
Edit1.Text:='';
Label4.Caption:=' * ';
BTN:=3;
end;

procedure TKakulator.Button4Click(Sender: TObject);
begin
STR:=Edit1.Text;
Edit1.Text:='';
Label4.Caption:=' / ';
BTN:=4;
end;

procedure TKakulator.Button8Click(Sender: TObject);
begin
Edit1.Text:=Edit1.Text+Button8.Caption;
end;

procedure TKakulator.Button7Click(Sender: TObject);
begin
Edit1.Text:=Edit1.Text+Button7.Caption;
end;

procedure TKakulator.Button6Click(Sender: TObject);
begin
Edit1.Text:=Edit1.Text+Button6.Caption;
end;

procedure TKakulator.Button5Click(Sender: TObject);
begin
Edit1.Text:=Edit1.Text+Button5.Caption;
end;

procedure TKakulator.Button9Click(Sender: TObject);
begin
Edit1.Text:=Edit1.Text+Button9.Caption;
end;

procedure TKakulator.Button10Click(Sender: TObject);
begin
Edit1.Text:=Edit1.Text+Button10.Caption;
end;

procedure TKakulator.Button11Click(Sender: TObject);
begin
Edit1.Text:=Edit1.Text+Button11.Caption;
end;

procedure TKakulator.Button12Click(Sender: TObject);
begin
Edit1.Text:=Edit1.Text+Button12.Caption;
end;

procedure TKakulator.Button16Click(Sender: TObject);
begin
Edit1.Text:=Edit1.Text+Button16.Caption;
end;

procedure TKakulator.Button15Click(Sender: TObject);
begin
Edit1.Text:=Edit1.Text+Button15.Caption;
end;

procedure TKakulator.Button14Click(Sender: TObject);
begin
Edit1.Text:=Edit1.Text+Button14.Caption;
end;

procedure TKakulator.Button13Click(Sender: TObject);
begin
if BTN=1 then
Memo1.Text :=FloatToStr(StrToFloat(str)+StrToFloat(Edit1.Text))
  else
if BTN=2 then
Memo1.Text :=FloatToStr(StrToFloat(str)-StrToFloat(Edit1.Text))
  else
  if BTN=3 then
Memo1.Text :=FloatToStr(StrToFloat(str)*StrToFloat(Edit1.Text))
  else
if BTN=4 then
Memo1.Text :=FloatToStr(StrToFloat(str)/StrToFloat(Edit1.Text));
  Label4.Caption:='Sama Dengan :';
end;

procedure TKakulator.Button17Click(Sender: TObject);
Var a,b:Extended;
begin
  Memo1.Clear;
  a:=StrToFloat(Edit1.Text);
  b:=StrToFloat(Edit1.Text);
  a:=Power(a,b);
  Memo1.Lines.Add('Nilai Pangkat X Adalah :'+FloatToStr(a));
end;

procedure TKakulator.Button20Click(Sender: TObject);
Var
c:real;
begin
c:=StrToFloat(Edit1.Text);
Memo1.Lines.Add('Nilai COS dari' + FloatToStr(c)+'Adallah = '+FloatToStr(COS(c)));
Label4.Caption:='Nilai Cos';

end;

procedure TKakulator.Button19Click(Sender: TObject);
Var
b:real;
begin
b:=StrToFloat(Edit1.Text);
Memo1.Lines.Add('Nilai SQRT-nya Adallah: '+FloatToStr(SQRT(b)));
Label4.Caption:='Nilai SQRT';
end;

procedure TKakulator.Button18Click(Sender: TObject);
Var
b:real;
begin
b:=StrToFloat(Edit1.Text);
Memo1.Lines.Add('Nilai SQR-nya Adallah = '+FloatToStr(SQR(b)));
Label3.Caption:='Nilai SQR';
end;

procedure TKakulator.Button24Click(Sender: TObject);
Var
d:real;
begin
d:=StrToFloat(Edit1.Text);
Memo1.Lines.Add('Nilai Sin Dari '+FloatToStr(d)+'Adalah = '+FloatToStr(Sin(d)));
Label4.Caption:='Nilai SIN';
end;

procedure TKakulator.Button23Click(Sender: TObject);
Var
C:real;
begin
C:=StrToFloat(Edit1.Text);
Memo1.Lines.Add('Nilai TAN Dari '+FloatToStr(c)+'Adalah = '+FloatToStr(Tan(c)));
Label4.Caption:='Nilai TAN';
end;

procedure TKakulator.Button22Click(Sender: TObject);
Var
b:real;
begin
b:=StrToFloat(Edit1.Text);
Memo1.Lines.Add('Nilai ARCCOS Dari '+FloatToStr(b)+'Adalah = '+FloatToStr(Arccos(b)));
Label4.Caption:='ARC COS';
end;

procedure TKakulator.Button21Click(Sender: TObject);
Var
c:real;
begin
c:=StrToFloat(Edit1.Text);
Memo1.Lines.Add('Nilai ARCSIN Dari '+FloatToStr(C)+'Adalah = '+FloatToStr(ARCSIN(C)));
Label4.Caption:='ARCSIN';
end;

procedure TKakulator.Button28Click(Sender: TObject);
Var
e:real;
begin
e:=StrToFloat(Edit1.Text);
Memo1.Lines.Add('Nilai ARCTAN Dari '+FloatToStr(e)+'Adalah = '+FloatToStr(ARCTAN(e)));
Label4.Caption:='ARCTAN';
end;

procedure TKakulator.Button27Click(Sender: TObject);
Var Cycle,hasil:extended;
begin
 Cycle:=StrToFloat(Edit1.Text);
 hasil:=CycleToRad(Cycle);
 Memo1.Lines.Add('Nilai Konversi dari'+FloatToStr(Cycle)+'Adalah ='
 +FloatToStr(hasil));
 Label4.Caption:='Cycle To Red';
end;

procedure TKakulator.Button26Click(Sender: TObject);
Var Derajat,hasil:extended;
begin
 Derajat:=StrToFloat(Edit1.Text);
 hasil:=DegToRad(Derajat);
 Memo1.Lines.Add('Nilai Konversi dari'+FloatToStr(Derajat)+'Adalah ='
 +FloatToStr(hasil));
 Label4.Caption:='Deg To Radian';
end;

procedure TKakulator.Button25Click(Sender: TObject);
Var Gradien,hasil:extended;
begin
 Gradien:=StrToFloat(Edit1.Text);
 hasil:=GradToRad(Gradien);
 Memo1.Lines.Add('Nilai Konversi dari'+FloatToStr(Gradien)+'Adalah ='
 +FloatToStr(hasil));
 Label4.Caption:='Grad To Red';
end;

procedure TKakulator.Button32Click(Sender: TObject);
Var Radian,hasil:extended;
begin
 Radian:=StrToFloat(Edit1.Text);
 hasil:=RadToDeg(Radian);
 Memo1.Lines.Add('Nilai Konversi dari'+FloatToStr(Radian)+'Adalah ='
 +FloatToStr(hasil));
 Label4.Caption:='Rad To Deg';
end;

procedure TKakulator.Button31Click(Sender: TObject);
Var radian,hasil:extended;
begin
 radian:=StrToFloat(Edit1.Text);
 hasil:=RadToGrad(radian);
 Memo1.Lines.Add('Nilai Konversi dari'+FloatToStr(radian)+'Adalah ='
 +FloatToStr(hasil));
 Label4.Caption:='Rad To Grad';
end;

procedure TKakulator.Button30Click(Sender: TObject);
Var radian,hasil:extended;
begin
 radian:=StrToFloat(Edit1.Text);
 hasil:=RadToCycle(radian);
 Memo1.Lines.Add('Nilai Konversi dari'+FloatToStr(radian)+'Adalah ='
 +FloatToStr(hasil));
 Label4.Caption:='Rad To Cycle';
end;

procedure TKakulator.Button29Click(Sender: TObject);
begin
Edit1.Text:='';
Memo1.Clear;
Label4.Caption:='';
ShowMessage('Data Sudah  Kosong');
end;

procedure TKakulator.Button33Click(Sender: TObject);
begin
Application.Terminate;
end;

procedure TKakulator.Timer1Timer(Sender: TObject);
begin
Label2.Caption:=FormatDateTime('"Sekarang Tanggal :"dd/mm/yyyy',now)+
FormatDateTime('"Pukul :"hh:nn:ss',now);
Label2.Refresh;
//animasi kedip
Label5.Left:=Label5.Left -1000;
if Label5.Left <-110 then
Label5.Left:=1030;
end;

end.

VIDIO:

Tidak ada komentar:

Posting Komentar