Silahkan klik gambar di bawah ini untuk mendonwload soucecode nya:
unit UnitJumHari;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Edit1: TEdit;
Edit2: TEdit;
Label1: TLabel;
Label2: TLabel;
Memo1: TMemo;
Label3: TLabel;
Label4: TLabel;
Shape1: TShape;
Bevel1: TBevel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
Function DaysPerMonth(YearIn, MonthIn: Integer): Integer;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
Function TForm1.DaysPerMonth(YearIn, MonthIn: Integer): Integer;
Const
DaysInMonth: array[1..12] of integer =
(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
begin
Result := DaysInMonth[MonthIn];
If (MonthIn = 2) and IsLeapYear(YearIn) then
Inc(Result);
End;
procedure TForm1.Button1Click(Sender: TObject);
Var
s1,s2:Integer;
Begin
s1:=strToint(edit1.text);
s2:=StrToInt(edit2.text);
Memo1.Lines.Clear;
Memo1.Lines.Add(IntToStr(DaysPerMonth(s1,s2)));
Memo1.Lines.Add('Hari');
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
halt;
end;
end.
Silahkan klik gambar di bawah ini untuk mendonwload soucecode nya: