SAY討論區

標題: Delphi: subroutines (問題在哪里??) [打印本頁]

作者: frankyhui    時間: 2012-5-12 02:29:49     標題: Delphi: subroutines (問題在哪里??)

<div class="blockcode"><span class="headactions" onclick="copycode($('code0'));">複製內容到剪貼板</span><h5>代碼:</h5><code id="code0">unit Unit1;

interface

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

type
TForm1 = class(TForm)
  Button1: TButton;
  Button2: TButton;
  procedure FormCreate(Sender: TObject);
  procedure Button1Click(Sender: TObject);
  procedure Button2Click(Sender: TObject);
private
  { Private declarations }
public
  { Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure SayHello(const sWhat:String);
begin
ShowMessage('Hello ' + sWhat);

end;

function YearsOld(const BirthYear:Integer) : Integer;
var
Year, Month, Day : word;

begin
DecodeDate(Date, Year, Month, Day);
Result := Year - BirthYear;

end;
procedure TForm1.Button1Click(Sender: TObject);
begin
SayHello('Delphi User');

end;

procedure TForm1.Button2Click(Sender: TObject);
begin
SayHello('Zarko Gajic');
ShowMessage('You are ' + IntToStr(YearsOld(1973)) + 'years old!');

end;

end.</code>
作者: mydear888    時間: 2012-5-13 23:11:24

這個貼好像之前沒見過  
作者: maverickhon    時間: 2012-5-13 23:11:24

呵呵 那就好好玩吧~~~~  
作者: tomato_alex    時間: 2012-5-13 23:11:24

估計你是沒見識過~` 呵呵  




歡迎光臨 SAY討論區 (http://say.go2tutor.com/) Powered by Discuz! X2