(1)
for i:=1 to 9 do begin for j:=1 to i do begin str:=inttostr(i)+'*'+inttostr(j)+'='+inttostr(i*j); Memo1.Text:=Memo1.Text+Str+' '; end; Memo1.Text:=Memo1.Text+#13+#10; end;
(2)
procedure TForm1.Button1Click(Sender: TObject); var a, b, n1, n2 :Integer; begin n1 := StrToInt( InputBox('n*n 乘法', '請輸入第一位數(shù)', '9') ); n2 := StrToInt( InputBox('n*n 乘法', '請輸入第二位數(shù)', '9') ); a := 1; for a := 1 to n1 do for b := 1 to n2 do Form1.Canvas.TextOut(b*60-50, a*15, IntToStr(a) + '*' + IntToSTr(b) + '=' + IntToStr(a*b)); end;
|