Zestaw 1.
Zadania 1.
procedure TForm1.Button1Click(Sender: TObject);
var i,n:integer;
suma:real;
begin
n:=StrToIntDef(Edit1.Text,1);
Edit1.Text:=IntToStr(n);
for i := 1 to n do suma:=suma+Power(-1,i+1)/(i*i);
Label3.Caption:=FloatToStrF(suma,ffNumber,4,2);
end;
end.
Zadanie 2.
procedure TForm1.FormShow(Sender: TObject);
var n: integer;
Sn,Sn2: double;
f:textFile;
begin
n:=10;
AssignFile(f,'C:\Wyniki\Plik.txt');
Rewrite(f);
repeat
Sn := Power(-1,n+1)/(n*n) ;
Sn2 := n - (PI*PI)/12;
Writeln(f,IntToStr(n) + ' ' + FloatToStr(Sn)+ ' ' + FloatToStr(Sn2));
n := n+10;
until n > 1000;
CloseFile(f);
end;
Zadanie 3.
Nie umiem ;/
Zadanie 4.
procedure TForm1.FormShow(Sender: TObject);
var i,j,temp:integer;
znak: char;
begin
randomize;
for i:=1 to 50 do
begin
for j:=1 to 10 do
begin
repeat
temp := random(91);
until (temp > 64) and (temp < 91);
A[i,j] := Chr(temp);
label1.Caption := label1.Caption + A[i,j] + ' ';
end;
label1.Caption:= label1.Caption + #13;
end;
Zadanie 5.
for i := 1 to 10 do
begin
znak := A[2,i];
A[2,i] := A[4,i];
A[4,i] := znak;
label2.Caption:=label2.Caption+A[2,i]+' ';
label3.caption:=label3.Caption+A[4,i]+' ';
end;
Zadanie 6.
procedure TForm1.FormResize(Sender: TObject);
begin
// czyszczenie okna
form1.Canvas.Brush.Color := clBtnFace;
form1.Canvas.Rectangle(0,0,form1.ClientWidth,form1.ClientHeight);
// rysowanie przekatnych
form1.Canvas.Pen.Color := clLime; //kolor
form1.Canvas.Pen.Style := psDot; //styl (kropki)
//form1.Canvas.Pen.Width := 4; //szerokosc linii
form1.Canvas.MoveTo(0,0);
form1.Canvas.lineto(form1.ClientWidth,form1.ClientHeight);
form1.Canvas.MoveTo(0,form1.ClientHeight);
form1.Canvas.lineto(form1.ClientWidth,0);
end;