
14.11.2009, 22:36
|
Прохожий
|
|
Регистрация: 28.06.2009
Сообщения: 37
Репутация: 10
|
|
Код:
procedure TForm7.ZM;
var
i,a:word;
label sn;
begin
Randomize;
SetLength(Spisok,kol);
for i:=0 to kol-1 do
begin
Spisok[i]:=255;
end;
for i:=0 to kol-1 do
begin
sn:
a:=random(146);
if poisk(a)=true then goto sn else Spisok[i]:=a;
end;
end;
procedure TForm7.Button6Click(Sender: TObject);
var
varnt:byte;
b:byte;
begin
record_in_file;
b:=spisok[sch];
if RadioButton1.Checked=true then varnt:=1;
if RadioButton2.Checked=true then varnt:=2;
if RadioButton3.Checked=true then varnt:=3;
if RadioButton4.Checked=true then varnt:=4;
if varnt=strtoint(ListBox1.Items[b*8+2]) then
Begin
inc(vern);
end
else
Begin
inc(nevern);
end;
if nevern>Form2.SpinEdit6.Value - Form2.SpinEdit10.Value then PR else
if sch=kol-1 then PR else
begin
inc(sch);
vopros(spisok[sch]);
end;
end;
procedure TForm7.vopros(a:word);
begin
Memo1.Lines[0]:=ListBox1.Items[a*8]; <- здесь вылетает ошибка, компилятор на эту строку ссылается
if strtoint(ListBox1.Items[a*8+1])=4 then
begin
RadioButton1.Visible:=true;
RadioButton2.Visible:=true;
RadioButton3.Visible:=true;
RadioButton4.Visible:=true;
RadioButton1.Caption:=ListBox1.Items[a*8+3];
RadioButton2.Caption:=ListBox1.Items[a*8+4];
RadioButton3.Caption:=ListBox1.Items[a*8+5];
RadioButton4.Caption:=ListBox1.Items[a*8+6];
end;
if strtoint(ListBox1.Items[a*8+1])=3 then
begin
RadioButton1.Visible:=true;
RadioButton2.Visible:=true;
RadioButton3.Visible:=true;
RadioButton4.Visible:=false;
RadioButton1.Caption:=ListBox1.Items[a*8+3];
RadioButton2.Caption:=ListBox1.Items[a*8+4];
RadioButton3.Caption:=ListBox1.Items[a*8+5];
end;
if strtoint(ListBox1.Items[a*8+1])=2 then
begin
RadioButton1.Visible:=true;
RadioButton2.Visible:=true;
RadioButton3.Visible:=false;
RadioButton4.Visible:=false;
RadioButton1.Caption:=ListBox1.Items[a*8+3];
RadioButton2.Caption:=ListBox1.Items[a*8+4];
end;
RadioButton1.Checked:=false;
RadioButton2.Checked:=false;
RadioButton3.Checked:=false;
RadioButton4.Checked:=false;
end;
procedure TForm7.PR;
var
rez:byte;
begin
Timer1.Enabled:=false;
Label5.Visible:=true;
Label1.Visible:=false;
Memo1.Visible:=false;
RadioGroup1.Visible:=false;
speedButton2.Visible:=false;
ProgressBar1.Position:=0;
ProgressBar1.Visible:=false;
Label3.Visible:=false;
Label4.Visible:=false;
Edit1.Visible:=false;
Edit2.Visible:=false;
Button5.Visible:=false;
RadioButton1.Visible:=false;
RadioButton2.Visible:=false;
RadioButton3.Visible:=false;
RadioButton4.Visible:=false;
If vern>=Form2.SpinEdit8.Value then rez:=5 else
if vern>=Form2.SpinEdit9.Value then rez:=4 else
if vern>=Form2.SpinEdit10.Value then rez:=3 else
rez:=2;
//if TimeOut=true then rez:=2;
Label5.Caption:='ваша оценка - '+inttostr(rez)+' ';
Label6.Visible:=true;
Label6.Caption:='правильных ответов - '+inttostr(vern)+' ';
Label7.Visible:=true;
Label7.Caption:='неправильных ответов - '+inttostr(nevern)+' ';
Memo2.Clear;
Memo2.Lines.Add('правильных ответов - '+inttostr(vern));
Memo2.Lines.Add('неправильных ответов - '+inttostr(nevern));
if TimeOut=true then Memo2.Lines.Add('время истекло');
Memo2.Lines.Add('оценка - '+inttostr(rez));
record_in_file;
SpeedButton1.Enabled:=true;
TimeOut:=false;
end;
procedure TForm7.ListBox1Click(Sender: TObject);
begin
//ListBox1.Items.LoadFromFile('c:\program files\result\vkt3.ctf');
ListBox1.Items.LoadFromFile('test\vkt3.ctf');
end;
procedure TForm7.SpeedButton1Click(Sender: TObject);
begin
//ListBox1.Items.LoadFromFile('c:\program files\result\vkt3.ctf');
ListBox1.Items.LoadFromFile('test\vkt3.ctf');
Label5.Visible:=false;
Label6.Visible:=false;
Label7.Visible:=false;
Label3.Visible:=true;
Label4.Visible:=true;
Edit1.Visible:=true;
Edit2.Visible:=true;
Button5.Visible:=true;
Edit1.Clear;
Edit2.Clear;
SpeedButton3.visible := false;
SpeedButton1.visible := false;
end;
procedure TForm7.record_in_file;
var
str1: string;
begin
if flag=true then begin
AssignFile(f,'c:\program files\result\'+famili+'_'+group+'.txt');
Append(f);
if label5.Caption<>'Label5' then begin
str1:=label5.Caption;
Writeln(f, str1);
str1:=label6.Caption;
Writeln(f, str1);
str1:=label7.Caption;
Writeln(f, str1);
flag:=false;
end
else begin
str1:=Memo1.Lines[0];
writeln(f, str1);
if RadioButton1.Checked then begin
str1:=RadioButton1.Caption;
writeln(f, str1);
end;
if RadioButton2.Checked then begin
str1:=RadioButton2.Caption;
writeln(f, str1);
end;
if RadioButton3.Checked then begin
str1:=RadioButton3.Caption;
writeln(f, str1);
end;
if RadioButton4.Checked then begin
str1:=RadioButton4.Caption;
writeln(f, str1);
end;
end;
CloseFile(f);
end;
end;
procedure TForm7.SpeedButton2Click(Sender: TObject);
var
varnt:byte;
b:byte;
begin
if ((radiobutton1.Checked and radiobutton2.Checked and radiobutton3.Checked and radiobutton4.Checked)<>true) then speedbutton2.visible:=false
else speedbutton2.Visible :=true;
record_in_file;
b:=spisok[sch];
if RadioButton1.Checked=true then varnt:=1;
if RadioButton2.Checked=true then varnt:=2;
if RadioButton3.Checked=true then varnt:=3;
if RadioButton4.Checked=true then varnt:=4;
if varnt=strtoint(ListBox1.Items[b*8+2]) then
Begin
inc(vern);
end
else
Begin
inc(nevern);
end;
if nevern>Form2.SpinEdit6.Value - Form2.SpinEdit10.Value then PR else
if sch=kol-1 then PR else
begin
inc(sch);
vopros(spisok[sch]);
end;
end;
end.
Помогите пожалуйста, а то меня убьют в понедельник(((
__________________
"I remember the good old days, when computers were
mainframes, analysts were magicians,and programmers
punced cards..."
|