Membuat Program Menghitung Umur Dengan Delphi
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, TeeProcs, TeEngine, Chart, Buttons, ComCtrls,
StdCtrls, XPMan;
type
TForm1 = class(TForm)
Chart1: TChart;
XPManifest1: TXPManifest;
GroupBox1: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Edit1: TEdit;
Edit2: TEdit;
DateTimePicker1: TDateTimePicker;
SpeedButton1: TSpeedButton;
GroupBox2: TGroupBox;
Memo1: TMemo;
Label4: TLabel;
procedure SpeedButton1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses DateUtils;
{$R *.dfm}
procedure TForm1.SpeedButton1Click(Sender: TObject);
Var
Nama,Alamat : String;
ThS,ThL,Umur: Integer;
begin
Nama := (Edit1.Text);
Alamat := (Edit2.Text);
ThS :=YearOf(now);
ThL :=YearOf(DateTimePicker1.Date);
Umur:=(ThS-ThL);
memo1.Lines.Add(' Hallo ' + (Nama));
memo1.Lines.Add(' Anda tinggal di ' + (Alamat));
memo1.Lines.Add(' Saat ini anda berumur ' + IntToStr(Umur)+ ' Tahun');
end;
end.
No comments:
Post a Comment