D de410 Unregistered / Unconfirmed GUEST, unregistred user! 2009-06-26 #2 unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs;type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1;implementation{$R *.dfm}Function fmt(n:integer):string;var j:integer; begin j:=length(inttostr); case j of 1:result:='00'+inttostr; 2:result:='0'+inttostr; 3:result:=inttostr; end; end; procedure TForm1.FormCreate(Sender: TObject);var i:integer; begin for i:=1 to 100do begin showmessage(fmt(i)); end; end; end.
unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs;type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1;implementation{$R *.dfm}Function fmt(n:integer):string;var j:integer; begin j:=length(inttostr); case j of 1:result:='00'+inttostr; 2:result:='0'+inttostr; 3:result:=inttostr; end; end; procedure TForm1.FormCreate(Sender: TObject);var i:integer; begin for i:=1 to 100do begin showmessage(fmt(i)); end; end; end.
P Passion Unregistered / Unconfirmed GUEST, unregistred user! 2009-06-26 #3 type THundred = 1..100;var a: THundred;a就只能是1到100了。
L liuls Unregistered / Unconfirmed GUEST, unregistred user! 2009-06-26 #4 定义子界类型的话,如 Passion 所说;输出的话可用 Format()var I: Integer; begin for I := 1 to 100do mmo1.lines.add(Format('%.3d', )); end;
定义子界类型的话,如 Passion 所说;输出的话可用 Format()var I: Integer; begin for I := 1 to 100do mmo1.lines.add(Format('%.3d', )); end;
W wind_2005 Unregistered / Unconfirmed GUEST, unregistred user! 2009-06-27 #5 你好像说的不是很清楚,一个数值能定义为多个值呢?而且是001,002,003.....,001只能是字符串而不能是数值。所以你描述清楚后大家才好帮你。[]