馬上註冊  |  找回密碼

SAY討論區

查看: 324|回復: 3
打印 上一主題 下一主題

Delphi: subroutines (問題在哪里??) [複製鏈接]

好友
0
帖子
124731
積分
124889
最後登錄
2019-2-28
在線時間
0 小時
跳轉到指定樓層
樓主
發表於 2012-5-12 02:29:49 |只看該作者 |倒序瀏覽
<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>
分享分享0 收藏收藏0 讚好讚好0 Unlike!Unlike!0 分享 傳送 邀請

Rank: 7Rank: 7Rank: 7

好友
0
帖子
125150
積分
125160
最後登錄
2019-2-28
在線時間
0 小時
No.1回覆者
發表於 2012-5-13 23:11:24 |只看該作者
這個貼好像之前沒見過  

好友
0
帖子
123890
積分
123896
最後登錄
2019-2-28
在線時間
0 小時
跟尾2
發表於 2012-5-13 23:11:24 |只看該作者
呵呵 那就好好玩吧~~~~  

好友
0
帖子
124733
積分
124739
最後登錄
2019-2-28
在線時間
0 小時
跟尾3
發表於 2012-5-13 23:11:24 |只看該作者
估計你是沒見識過~` 呵呵  
您需要登錄後才可以回帖 登錄 | 馬上註冊 |

Archiver|手機版|SAY討論區

GMT+8, 2026-5-27 22:06 , Processed in 2.248969 second(s), 8 queries .

Powered by go2tutor.comDiscuz! X2

© 2026 Community Networks Limited

回頂部