unit
Unit12;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls, unit11;
type
TForm12 =
class
(TForm)
RadioGroup1: TRadioGroup;
GroupBox1: TGroupBox;
BitBtn1: TBitBtn;
Panel1: TPanel;
Label1: TLabel;
procedure
FormCreate(Sender: TObject);
procedure
BitBtn1Click(Sender: TObject);
procedure
FormClose(Sender: TObject;
var
Action: TCloseAction);
private
public
end
;
var
Form12: TForm12;
balls :
integer
;
q, Log_File : textfile;
five, four, three,
ans1mark, ans2mark, ans3mark, ans4mark :
integer
;
question, answere1, answere2, answere3,
answere4, tmp_q, result :
string
;
flag_end, flag_write :
boolean
;
implementation
uses
Unit1, Unit10, Unit2, Unit3, Unit4, Unit5, Unit6, Unit7, Unit8, Unit9;
{$R *.dfm}
procedure
Read_next_q();
var
AYear, AMonth, ADay, Hour, Min, Sec, MSec:
Word
;
Data :
string
;
begin
if
EOF (q)
then
begin
flag_end :=
true
;
if
balls>=five
then
result:=
'Отлично ('
+IntToStr(balls)+
' балла(ов))'
;
if
(balls>=four)
and
(balls<five)
then
result:=
'Хорошо ('
+IntToStr(balls)+
' балла(ов))'
;
if
(balls>=three)
and
(balls<four)
then
result:=
'удовлетворительно ('
+IntToStr(balls)+
' балла(ов))'
;
if
balls<three
then
result:=
'НЕУДОВЛЕТВОРИТЕЛЬНО ('
+IntToStr(balls)+
' балла(ов))'
+#
13
#
10
+
'Тест НЕ сдан!'
;
showmessage(
'Вы сдали тест на '
+#
13
#
10
+Result);
DecodeDate(Now, AYear, AMonth, ADay);
DecodeTime(Now, Hour, Min, Sec, MSec);
Data:=IntToStr(AYear)+
'/'
+IntToStr(AMonth)+
'/'
+IntToStr(ADay)+
' '
+IntToStr(Hour)+
':'
+IntToStr(Min)+
':'
+IntToStr(Sec)+
' '
;
writeln
(Log_File, Data+Result+#
13
#
10
+#
13
#
10
);
closeFile(Log_File);
Form12
.
BitBtn1
.
Enabled:=
false
;
end
else
begin
Readln(q,tmp_q);
question:=tmp_q+#
13
#
10
;
Readln(q,tmp_q);
question:=question+tmp_q+#
13
#
10
;
Readln(q,tmp_q);
question:=question+tmp_q+#
13
#
10
;
Readln(q,answere1);
Readln(q,ans1mark);
Readln(q,answere2);
Readln(q,ans2mark);
Readln(q,answere3);
Readln(q,ans3mark);
Readln(q,answere4);
Readln(q,ans4mark);
Form12
.
Label1
.
Caption:=question;
Form12
.
RadioGroup1
.
Items[
0
]:=answere1;
Form12
.
RadioGroup1
.
Items[
1
]:=answere2;
Form12
.
RadioGroup1
.
Items[
2
]:=answere3;
Form12
.
RadioGroup1
.
Items[
3
]:=answere4;
end
;
end
;
procedure
check_ans();
begin
if
(Form12
.
RadioGroup1
.
ItemIndex=
0
)
and
(flag_end=
false
)
then
balls:=balls+ans1mark;
if
(Form12
.
RadioGroup1
.
ItemIndex=
1
)
and
(flag_end=
false
)
then
balls:=balls+ans2mark;
if
(Form12
.
RadioGroup1
.
ItemIndex=
2
)
and
(flag_end=
false
)
then
balls:=balls+ans3mark;
if
(Form12
.
RadioGroup1
.
ItemIndex=
3
)
and
(flag_end=
false
)
then
balls:=balls+ans4mark;
Form12
.
RadioGroup1
.
ItemIndex:=-
1
;
end
;
procedure
TForm12
.
FormCreate(Sender: TObject);
begin
Form12
.
Left:=Screen
.
Width+
100
;
Form12
.
Top:=Screen
.
Height+
100
;
flag_end:=
false
;
AssignFile(q,
'q.txt'
);
Reset(q);
Readln(q,five);
Readln(q,four);
Readln(q,three);
Read_next_q;
end
;
procedure
TForm12
.
BitBtn1Click(Sender: TObject);
begin
if
Form12
.
RadioGroup1
.
ItemIndex<>-
1
then
begin
check_ans;
Read_next_q;
end
else
showmessage(
'Выберите один из вариантов'
+#
13
#
10
+
'ответов и нажмите "Далее"!'
);
end
;
procedure
TForm12
.
FormClose(Sender: TObject;
var
Action: TCloseAction);
begin
Application
.
Terminate;
end
;
end
.