主题:送分了哦
procedure TForm1.FormCreate(Sender: TObject);
var
m,n,k:integer;
begin
randomize;
m:=random(50);
n:=random(50);
k:=random(2);
label1.Caption :=inttostr(m);
label2.Caption :=inttostr(n);
if k=1 then
label2.Caption :='+'
else
label2.Caption :='-';
end;
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
var
answer:integer ;
begin
if key=chr(VK_RETURN) then
answer:=strtoint(label1.caption)+strtoint(label3.Caption)
else
answer:=strtoint(label1.caption)+strtoint(label3.Caption);
if answer=strtoint(edit1.text) then
begin
showmessage('回答正确');
button1.SetFocus ;
end
else
begin
showmessage('回答错误');
edit1.SetFocus ;
end;
edit1.SelectAll;
end;
end;
问题在最后的一个end处,
提示是不能编译
var
m,n,k:integer;
begin
randomize;
m:=random(50);
n:=random(50);
k:=random(2);
label1.Caption :=inttostr(m);
label2.Caption :=inttostr(n);
if k=1 then
label2.Caption :='+'
else
label2.Caption :='-';
end;
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
var
answer:integer ;
begin
if key=chr(VK_RETURN) then
answer:=strtoint(label1.caption)+strtoint(label3.Caption)
else
answer:=strtoint(label1.caption)+strtoint(label3.Caption);
if answer=strtoint(edit1.text) then
begin
showmessage('回答正确');
button1.SetFocus ;
end
else
begin
showmessage('回答错误');
edit1.SetFocus ;
end;
edit1.SelectAll;
end;
end;
问题在最后的一个end处,
提示是不能编译