語法:
procedure TForm1.Button1Click(Sender: TObject);  //for do迴圈
var
  i,j:integer;
  sum:string;
begin
  sum:='';
  for i:=65 to 71 do
    begin
      for j:=1 to (72-i) do
        begin
          sum:=sum + chr(i);
        end;
      sum:=sum+#10#13;
    end;
  label1.Caption:=sum;
end;

procedure TForm1.Button4Click(Sender: TObject);  //清除畫面
begin
label1.Caption:='';
end;

procedure TForm1.Button2Click(Sender: TObject);  //while do迴圈
var
  i,j:integer;
  sum:string;
begin
  sum:='';
  i:=65;
  while i     begin
      j:=1;
      while j         begin
          sum:=sum + chr(i);
          j:=j+1;
        end;
      sum:=sum+#10#13;
      i:=i+1;
    end;
  label1.Caption:=sum;
end;

procedure TForm1.Button3Click(Sender: TObject);  //repeat until迴圈
var
  i,j:integer;
  sum:string;
begin
  i:=65;
  sum:='';
  repeat
    j:=1;
    repeat
      sum:=sum+char(i);
      j:=j+1;
    until j > 72-i;
  sum:=sum+#10#13;
  i:=i+1;
  until i >71;
  label1.Caption:=sum;
end;

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 浮雲 的頭像
    浮雲

    missice's Blog

    浮雲 發表在 痞客邦 留言(0) 人氣()