program magaz uses CRT type TZ record nomer integer name string 20 izd

  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
program magaz;
uses CRT;
type TZ = record
nomer:integer;
name:string[20];
izd: string[15];
price: real;
data: string[8];
sum: real;
stop: boolean;
data_otgr: string[8];
end;
FT= file of TZ;
var a:FT;
v,l,k,g:integer;
ch:char;
procedure Input (var a: FT);
var i:integer;
begin
end;
Procedure Create (var a:FT);
Var i,j:integer;
zk:TZ;
mas: array [1..6] of longint;
begin
clrscr;
l:=l+1;
reset(a);
seek(a,filesize(a));
begin
zk.nomer:=l;
write ('Name input ');
readln (zk.name);
write ('Product name ');
readln (zk.izd);
write ('vvedite cenu ');
readln (zk.price);
write ('vvedite summu zadatka ');
readln (zk.sum);
write ('vvedite datu pokupki ');
readln (zk.data);
if zk.sum<zk.price then zk.stop:=false else zk.stop:=true;
if zk.sum=zk.price then
begin
write ('vvedite datu otgruzki ');
readln (zk.data_otgr);
end
else zk.data_otgr:='';
write (a,zk);
end;
end;
Procedure Output (var a:ft);
Var i:integer;
zk:TZ;
begin
clrscr;
writeln ('Prass any key');
reset (a);
writeln('v BD ',l,' zapisej');
while not eof(a) do
begin
read (a,zk);
write ('|',zk.nomer:6,'|');
write ('|',zk.name:6,'|');
write ('|',zk.izd:9,'|');
write ('|',zk.price,'|');
write ('|',zk.data,'|');
write ('|',zk.sum,'|');
write ('|',zk.stop,'|');
if (zk.data_otgr<>'') then write ('|',zk.data_otgr,'|');
writeln;
writeln ('----------------------------------------');
end;
close (a);
readln ();
end;
Procedure poisk (var a:ft);
var i:integer;
zk:TZ;
num:integer;
dataot:string;
begin
clrscr;
writeln ('Prass any key');
reset (a);
writeln ('Vvedite nomer dlja poiska ');
readln (num);
writeln ('Vvedite datu otgruzki dlja poiska ');
readln (dataot);
writeln ('Po zaprosu najdeno ');
while not eof(a) do
begin
read (a,zk);
if (zk.nomer=num) and (dataot=zk.data_otgr) then
begin
write ('|',zk.nomer:6,'|');
write ('|',zk.name:6,'|');
write ('|',zk.izd:9,'|');
write ('|',zk.price,'|');
write ('|',zk.sum,'|');
write ('|',zk.stop,'|');
if (zk.data_otgr<>'') then write ('|',zk.data_otgr,'|');
writeln;
writeln ('----------------------------------------');
end;
end;
close(a);
readln();
end;
Procedure bw (var a:ft);
var i,n,j:integer;
g:real;
zk:TZ;
k:string;
mas1: array [1..6] of string;
mas2: array [1..6] of real;
begin
clrscr;
for i := 1 to 5 do mas1[i]:=' ';
reset (a);
while not eof(a) do
begin
read (a,zk);
{write (zk.name:10);}
for i:=1 to 5 do
begin
{if zk.name<>mas1[i] and mas1[i] = '' then}
if zk.name<>mas1[i] and mas1[i]='' then
begin
{write ('a'); }
mas1[i]:=zk.name;
mas2[i]:=zk.sum+mas2[i];
i:=5;
end
else
begin
{write ('b'); }
mas2[i]:=zk.sum+mas2[i];
i:=5;
end;
end;
end;
{ for i := 1 to 4 do
for j := 1 to 5-i do
if mas1[j] > mas1[j+1] then begin
k := mas1[j];
mas1[j] := mas1[j+1];
mas1[j+1] := k
end; }
for i := 1 to 5 do write (mas1[i]:10);
writeln;
close (a);
readln ();
end;
label Start;
begin
l:=0;g:=0;
assign (a,'fff');
rewrite (a);
close (a);
Start:
clrscr;
writeln (' Menu ');
writeln ('1:Output ');
writeln ('2:Create ');
writeln ('4:Oformlenie otgruzki tovara ');
writeln ('5:Best worker ');
writeln ('7:Exit ');
while 1=1 do begin
readln(v);
case v of
1:begin Output (a); goto Start; end;
2:begin Create (a); goto Start; end;
{3:}
4:begin poisk (a); goto Start; end;
5:begin bw (a); goto Start; end;
{6:}
7:begin exit; end;
end;
end;
end.