1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
| unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, inifiles;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
Button3: TButton;
Button4: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
results: tinifile;
a,b,num,tr,x,n,y,z:integer;
orig,ans:array[1..10] of integer;
implementation
{$R *.dfm}
uses unit2, unit3;
procedure test(label2: TLabel; edit1: TEdit );
label aaa;
begin
tr:= 0;
randomize;
aaa:
a:= random(9);
b:= random(9);
if (a=0) or (b=0) then goto aaa
else
begin
label2.Caption:= 'Чему равно произведение '+inttostr(a)+'*'+inttostr(b)+'?';
end;
x:= a*b;
y:= y+1;
orig[y]:= x;
end;
procedure prov;
var
I: Integer;
begin
for I := 1 to 10 do
begin
if orig[i]=ans[i] then tr:=tr+1;
end;
if tr>=9 then
begin
num:= results.ReadInteger('num','num',1);
results.WriteString('results','fio'+inttostr(num-1),'"Отлично!"');
showmessage('Ваш результат:'+#10#13+'"Отлично!"');
end;
if tr=8 then
begin
num:= results.ReadInteger('num','num',1);
results.WriteString('results','fio'+inttostr(num-1),'"Хорошо!"');
showmessage('Ваш результат:'+#10#13+'"Хорошо!"');
end;
if (tr>=6) and (tr<8) then
begin
num:= results.ReadInteger('num','num',1);
results.WriteString('results','fio'+inttostr(num-1),'"Удовлетворительно!"');
showmessage('Ваш результат:'+#10#13+'"Удовлетворительно!"');
end;
if tr<6 then
begin
num:= results.ReadInteger('num','num',1);
results.WriteString('results','fio'+inttostr(num-1),'"Неудовлетворительно!"');
showmessage('Ваш результат:'+#10#13+'"Неудовлетворительно!"');
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
form1.Enabled:= false;
form2.Enabled:= true;
form2.Visible:= true;
form2.Edit1.SetFocus;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
form1.Enabled:= false;
form3.Visible:= true;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
n:= 1;
button3.Visible:= false;
button4.Visible:= true;
edit1.Visible:= true;
edit1.SetFocus;
label1.Caption:= 'Вопрос №'+inttostr(n);
test(label2,edit1);
n:= n+1;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
x:= a*b;
if n<11 then test(label2,edit1) else
begin
prov;
button1.Visible:= true;
button2.Visible:= true;
button3.Visible:= false;
button4.Visible:= false;
edit1.Visible:= false;
label1.Visible:= false;
label2.Visible:= false;
end;
z:= z+1;
ans[z]:= strtoint(edit1.Text);
label1.Caption:= 'Вопрос №'+inttostr(n);
n:= n+1;
if edit1.Visible = true then edit1.SetFocus;
sleep(250);
edit1.Clear;
end;
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if key in ['A'..'Z','a'..'z','А'..'Я','а'..'я'] then key:= #0;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
{$I-}
results:= tinifile.Create(extractfilepath(paramstr(0))+'results.ini');
num:= results.ReadInteger('num','num',1);
results.WriteString('Программа проверки знания таблицы умножения','2*2','4');
if IOresult<>0 then
begin
results.WriteInteger('num','num',1);
num:= results.ReadInteger('num','num',1);
end;
end;
end.
unit Unit2;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, inifiles, Vcl.StdCtrls;
type
TForm2 = class(TForm)
Edit1: TEdit;
Label1: TLabel;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
uses unit1, unit3;
procedure TForm2.Button1Click(Sender: TObject);
begin
form1.Enabled:= true;
form1.SetFocus;
form2.Enabled:= false;
form2.Visible:= false;
form1.Enabled:= true;
results.WriteString('list','fio'+inttostr(num),edit1.Text);
num:= num+1;
results.WriteInteger('num','num',num);
form1.Button1.Visible:= false;
form1.Button2.Visible:= false;
form1.Label1.Visible:= true;
form1.Label2.Visible:= true;
form1.Button3.Visible:= true;
y:= 0;
z:= 0
end;
procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
begin
form1.Enabled:= true;
end;
end.
unit Unit3;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
type
TForm3 = class(TForm)
ListBox1: TListBox;
Label1: TLabel;
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form3: TForm3;
implementation
{$R *.dfm}
uses unit1, unit2;
procedure TForm3.Button1Click(Sender: TObject);
begin
deletefile(extractfilepath(paramstr(0))+'results.ini');
end;
procedure TForm3.FormClose(Sender: TObject; var Action: TCloseAction);
begin
form3.Visible:= false;
form1.Enabled:= true;
end;
procedure TForm3.FormCreate(Sender: TObject);
var
I: Integer;
begin
for I := 1 to results.ReadInteger('num','num',12) do
begin
listbox1.Items[i-1]:= results.ReadString('list','fio'+inttostr(i),'')+' - '+
results.ReadString('results','fio'+inttostr(i),'');
end;
end;
end. |