witam
może na wstępie walnę kod źródłowy:
unit grafy;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
tab=array[1..20,1..20] of string;
TForm1 = class(TForm)
Label1: TLabel;
Button1: TButton;
Label2: TLabel;
Button2: TButton;
Label3: TLabel;
Button3: TButton;
Label4: TLabel;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
a:integer; t:tab;
implementation
{$R *.dfm}
procedure dotab(var t:tab; var a:integer);
var i,j:byte;
begin
if a<>0 then
begin
for i:=1 to a do
for j:=1 to a do
begin
t[i,j]:='0';
if i=j then t[i,j]:='x';
end;
end;
end;
procedure sprawdz(var a:integer; t:tab);
var i,j:byte;
begin
a:=a;
for i:=1 to a do
for j:=1 to a do
begin
t[i,j]:=t[i,j];
end;
end;
procedure start(var a:integer; var t:tab);
begin
a:=0;
dotab(t,a);
end;
procedure dodaj(var a:integer);
begin
a:=a+1;
if a>20 then a:=20;
end;
procedure odejmij(var a:integer);
begin
a:=a-1;
if a<0 then a:=0;
end;
procedure TForm1.FormCreate(Sender: TObject);
var a:integer; t:tab;
begin
start(a,t);
Label1.Caption:='0';
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
dodaj(a);
Label1.Caption:=IntToStr(StrToInt(Label1.Caption)+1);
if StrToInt(Label1.Caption)>20 then Label1.Caption:='20';
end;
procedure TForm1.Button2Click(Sender: TObject);
var a:integer;
begin
odejmij(a);
Label1.Caption:=IntToStr(StrToInt(Label1.Caption)-1);
if StrToInt(Label1.Caption)<0 then Label1.Caption:='0';
end;
procedure TForm1.Button3Click(Sender: TObject);
var a:integer; i,j:byte; t:tab;
begin
sprawdz(a,t);
for i:=1 to a do
for j:=1 to a do
begin
Label4.Caption:=Label4.Caption+t[i,j]+' ';
if j=a then Label4.Caption:=Label4.Caption+#10;
end;
end;
end.
no i po kompilacji wszystko ok wcisnę przycisk button3 ("wyswietl macierz") i wywala się, czy ktoś mi powie czemu??? dzięki z góry :|
// następnym razem napisz właściwy temat, bo będziemy usuwać wątki - ŁF