delphi题。使用随机数,产生7题0-100的加法运算。这题该怎么做啊。。。想了好久都不懂耶。。。

来源:百度知道 编辑:UC知道 时间:2024/06/06 15:06:06
不详细。。。。看不懂。。。。

procedure TForm3.FormCreate(Sender: TObject);
var

I: Integer;
begin
Randomize;
for I := 0 to 7 - 1 do
begin
a1[i]:=Random(100);
a2[i]:=Random(100);
end;
//all initialization complete.
//now display it for user
txt1.text:=IntToStr(a1[0]);
..............
省略。
end;
最后判断
procedure TForm3.btn1Click(Sender: TObject);
begin
if StrToIntDef(txtJieGuo.Text,0)=a1[0]+a2[0] then
Inc(DaDuiLe);
...........................
ShowMessageFmt('你答对了 %S 道题,恭喜',[DaDuiLe]);
end;