var KodeHari: Integer;
  Hari,Zodiak : string[10];
  Tanggal: Tdatetime;
  Thn,Tgl,Bln : Word;
procedure TForm1.Button2Click(Sender: TObject);
begin
Ed_Tanggal.Text:='';
Ed_Hari.Text:='';
Ed_Zodiak.Text:='';
Ed_Tanggal.setfocus
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Dateseparator:='-';
Tanggal:=StrToDate(Ed_Tanggal.Text);
KodeHari:=DayOfWeek(tanggal);
  case KodeHari of
    1: Hari:='Minngu';
    2: Hari:='Senin';
    3: Hari:='Selasa';
    4: Hari:='Rabu';
    5: Hari:='Kamis';
    6: Hari:='Jumat';
    7: Hari:='Sabtu';
end;
Ed_Hari.Text:=Hari;

DecodeDate(Tanggal,Thn,Bln,Tgl);

if ((Tgl>=21) and (Bln=3)) or ((Tgl<=19) and (Bln=4)) then
Zodiak:= 'Aries'
else if ((Tgl>=20) and (Bln=4)) or ((Tgl<=20) and (Bln=5)) then
Zodiak:= 'Taurus'
else if ((Tgl>=21) and (Bln=5)) or ((Tgl<=21) and (Bln=6)) then
Zodiak:= 'Gemini'
else if ((Tgl>=22) and (Bln=6)) or ((Tgl<=22) and (Bln=7)) then
Zodiak:= 'Cancer'
else if ((Tgl>=23) and (Bln=7)) or ((Tgl<=22) and (Bln=8)) then
Zodiak:= 'Leo'
else if ((Tgl>=23) and (Bln=8)) or ((Tgl<=22) and (Bln=9)) then
Zodiak:= 'Virgo'
else if ((Tgl>=23) and (Bln=9)) or ((Tgl<=23) and (Bln=10)) then
Zodiak:= 'Libra'
else if ((Tgl>=24) and (Bln=10)) or ((Tgl<=21) and (Bln=11)) then
Zodiak:= 'Scorpio'
else if ((Tgl>=22) and (Bln=11)) or ((Tgl<=21) and (Bln=12)) then
Zodiak:= 'Sagitarius'
else if ((Tgl>=22) and (Bln=12)) or ((Tgl<=19) and (Bln=1)) then
Zodiak:= 'Capricorn'
else if ((Tgl>=20) and (Bln=1)) or ((Tgl<=18) and (Bln=2)) then
Zodiak:= 'Aquarius'
else if ((Tgl>=19) and (Bln=2)) or ((Tgl<=20) and (Bln=3)) then
Zodiak:= 'Pisces'
else
Zodiak:='_';
Ed_Zodiak.Text:=Zodiak;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
application.Terminate
end;

end.
Show comments
Hide comments
0 Komentar untuk : Program Delphi Menampilkan Zodiak Berdasarkan tanggal Lahir