28 Mayıs 2014 Çarşamba

list of integers,square of integers,square root of integers,stringgrid,progressbar example

procedure TForm1.Button1Click(Sender: TObject);
var
 a,b,j,k:integer;
begin
 a:=strtoint(edit1.text);
 b:=strtoint(edit2.text);
 StringGrid1.RowCount:=(b-a+1)+1;
  for j:=1 to stringgrid1.RowCount-1 do
   StringGrid1.Cells[0,j]:=inttostr(j);
  j:=0;
  ProgressBar1.Max:=b-a+1;
  if RadioButton1.Checked then
   begin
    for k:=a to b do
    begin
    inc(j);
    StringGrid1.Cells[1,j]:=inttostr(k);
    ProgressBar1.Position:=j;
    end;
   end
  else if RadioButton2.Checked then
   begin
    for k:=a to b do
    begin
    inc(j);
    StringGrid1.Cells[1,j]:=inttostr(sqr(k));
    ProgressBar1.Position:=j;
    end;
   end
  else if RadioButton3.Checked then
   begin
    for k:=a to b do
    begin
    inc(j);
    StringGrid1.Cells[1,j]:=floattostr(sqrt(k));
    ProgressBar1.Position:=j;
    end;
   end;

end;
end.




Hiç yorum yok:

Yorum Gönder