線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:3455
推到 Plurk!
推到 Facebook!

九九乘法範例

 
qoo1234
版主


發表:256
回覆:1167
積分:659
註冊:2003-02-24

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-07-11 16:41:39 IP:61.216.xxx.xxx 未訂閱
unit Unit1;    interface    uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Grids;    type
  TForm1 = class(TForm)
    Button1: TButton;
    StringGrid1: TStringGrid;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;    var
  Form1: TForm1;    implementation    {$R *.dfm}    procedure TForm1.Button1Click(Sender: TObject);
var
  i,j,result:integer;
begin
 For i:=1 to 9 do
 begin
  For j:=1 to 9 do
  begin
   result:=i*j;
   StringGrid1.Cells[i,j]:= Format('%d*%d =%-3d',[i,j,result]); 
  end;
 end;
end;    end.
 
網海無涯,學無止境!
qoo1234
版主


發表:256
回覆:1167
積分:659
註冊:2003-02-24

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-07-11 16:47:54 IP:61.216.xxx.xxx 未訂閱
網海無涯,學無止境!
qoo1234
版主


發表:256
回覆:1167
積分:659
註冊:2003-02-24

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-07-11 23:09:43 IP:61.217.xxx.xxx 未訂閱
 
//承上例:    unit Unit1;    interface    uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Grids;    type
  TForm1 = class(TForm)
    Button1: TButton;
    StringGrid1: TStringGrid;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;    var
  Form1: TForm1;    implementation    {$R *.dfm}    procedure TForm1.Button1Click(Sender: TObject);
var
  i,j,result:integer;
begin
 For i:=1 to 9 do
 begin
  For j:=1 to 9 do
  begin
   result:=i*j;
   StringGrid1.Cells[j,0]:=inttostr(j);   //抬頭
   StringGrid1.Cells[0,j]:=inttostr(j);   //抬頭
   //StringGrid1.Cells[i,j]:= Format('%d*%d =%-3d',[i,j,result]);//顯示完整結果
   StringGrid1.Cells[i,j]:= Format('%d',[result]);//顯示只有答案
  end;
 end;
end;    end.    
網海無涯,學無止境!
syntax
尊榮會員


發表:26
回覆:1139
積分:1258
註冊:2002-04-23

發送簡訊給我
#4 引用回覆 回覆 發表時間:2003-09-27 13:27:14 IP:203.222.xxx.xxx 未訂閱
版主真是照顧新手啊 這樣的東西也給他發表來讓新手學習 呵 呵
qoo1234
版主


發表:256
回覆:1167
積分:659
註冊:2003-02-24

發送簡訊給我
#5 引用回覆 回覆 發表時間:2003-09-27 13:38:08 IP:218.163.xxx.xxx 未訂閱
引言: 版主真是照顧新手啊 這樣的東西也給他發表來讓新手學習 呵 呵
資料結構與演算法討論區~不分基本或是高水準的都可以在此區發表! 大家歡喜就好~ < src="http://delphi.ktop.com.tw/download/upload\33223_qoo.gif">網海無涯,學無止境!
jackkcg
站務副站長


發表:891
回覆:1050
積分:848
註冊:2002-03-23

發送簡訊給我
#6 引用回覆 回覆 發表時間:2003-09-27 13:58:16 IP:61.221.xxx.xxx 未訂閱
以前我老板教delphi就是這個99乘法表範例 並要求 寫出 delphi的最少3種不同方式來達到結果 寫出來就代表 學會 演算法 的精神 哈哈 (想辦法把數學公式轉換程式語言) 有人可以再寫出3種不同方式嗎 很期待 如果要更高境界的 可以試看看16歲小女孩的這個演算法 http://delphi.ktop.com.tw/topic.php?TOPIC_ID=21635 看看是否 知道他在寫殺咪 原碼已經被砍了 就靠大家寫出來了 ********************************************************* 哈哈&兵燹 最會的2大絕招 這個不會與那個也不會 哈哈哈 粉好 Delphi K.Top的K.Top分兩個字解釋Top代表尖端的意思,希望本討論區能提供Delphi的尖端新知 K.表Knowlege 知識,就是本站的標語:Open our mind to make knowledge together! 希望能大家敞開心胸,將知識寶庫結合一起 發表人 - jackkcg 於 2003/09/27 14:08:40
------
**********************************************************
哈哈&兵燹
最會的2大絕招 這個不會與那個也不會 哈哈哈 粉好

Delphi K.Top的K.Top分兩個字解釋Top代表尖端的意思,希望本討論區能提供Delphi的尖端新知
K.表Knowlege 知識,就是本站的標語:Open our mind
系統時間:2024-05-05 15:40:21
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!