Вот текст проги которая выводит строки из файла в метку, рандомом и без повторения, в начале все эти строки файла текстового мы загоняем в массив. Проблемка в том что когда я все 40 вопросов вывел прога виснет, просьба огромная помогите, подскажите где глюк...
unit Unit4;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, jpeg;
type
TForm4 = class(TForm)
Image1: TImage;
Panel1: TPanel;
Button2: TButton;
Label1: TLabel;
Button1: TButton;
CheckBox1: TCheckBox;
CheckBox2: TCheckBox;
CheckBox3: TCheckBox;
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form4: TForm4;
A:array [1..40]of string;
S:set of 1..40;
implementation
uses Unit1;
{$R *.dfm}
procedure TForm4.Button2Click(Sender: TObject);
begin
close;
Form1.close;
end;
procedure TForm4.FormCreate(Sender: TObject);
var
f:textfile;
i,n:byte;
begin
S:=[1..40];
assignfile(f,'Lin.txt');
reset(f);
for i:=1 to 40 do
begin
while not Eoln(f) do
read(f,A[i]);
readln(f);
end;
randomize;
n:=random(40);
exclude(s,n);
label1.Caption:=(A[n]);
end;
procedure TForm4.Button1Click(Sender: TObject);
var
n:byte;
y:boolean;
begin
y:=false;
while y=false do
begin
if S=[] then
begin
close;
Form1.close;
end
else
begin
randomize;
n:=random(40);
if n in s then
begin
exclude(s,n);
label1.Caption:=(A[n]);
y:=true;
end;
end;
end;
end;
end.
Народ срочно нужен хелп..., помощь с прогой... |