Randomize; (运行到这行就显示错误,而且在错误提示栏中还有不少错列)
for i:=1 to 2 do
begin
j:=Random(26);
if j = 0 then j := j + 1;
str := str + StrConst1[j];
end;
for i:=1 to 8 do
begin
j:=Random(10);
if j = 0 then j := j + 1;
str := str + StrConst2[j];
end;
[错误] Unit1.pas(34): ',' or ':' expected but ';' found
[错误] Unit1.pas(35): Identifier redeclared: 'i'
[错误] Unit1.pas(42): Declaration expected but 'FOR' found
[错误] Unit1.pas(44): Undeclared identifier: 'j'
[警告] Unit1.pas(45): Comparing signed and unsigned types - widened both operands
[错误] Unit1.pas(46): '(' expected but ':=' found
[错误] Unit1.pas(46): Not enough actual parameters
[错误] Unit1.pas(47): Expression expected but 'END' found
[警告] Unit1.pas(48): Text after final 'END.' - ignored by compiler
[致命错误] Project2.dpr(5): Could not compile used unit 'Unit1.pas'
type
TForm1 = class(TForm)
Button1: TButton;
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: integer;
str : string;
begin
Randomize;
for i:=1 to 2 do begin
j:=Random(26);
if j = 0 then j := j + 1;
str := str + StrConst1[j];
end;
for i:=1 to 8 do begin
j:=Random(10);
if j = 0 then j := j + 1;
str := str + StrConst2[j];
end;
end;