
problema de estadísticas de movimiento vehicular
Publicado por carolina (22 intervenciones) el 24/09/2016 17:52:04
buen dia porfa necesito una ayuda con este programa en la parte de menú y si esta bien estructurado.
adjunto las especificaciones del trabajo le agradeceria que me ayuden en la parte de los menus que piden en el trabajo y si el metodo de ordenacion esta bien.. gracias
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
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
program estadistica;
uses
crt;
const
tipove : array[1..4] of string[20] = ('particulares','porpuesto','taxi','transporte publicos');
acion : array['A'..'B'] of string[5] =('Sale','Entra');
type
regvehiculo = record
nplaca : string[20];
npasaj : integer;
alcabala : string[20];
fecha : string[10];
tipovl : byte;
salent : string[5];
end;
var
datos : array[0..200] of regvehiculo;
cont : integer;
tecla : char;
procedure entrada_datos;{PROCEDIMIENTO PARA INCLUIR DATOS}
var
d : integer;
cu : char;
begin
writeln('***** Entrada De Datos Vehiculos *****');
writeln;
write(' Numero Placa : ');
readln(datos[cont].nplaca);
for d := 1 to length(datos[cont].nplaca) do
datos[cont].nplaca[d] := upcase(datos[cont].nplaca[d]);
write(' Numero Pasajeros : ');
readln(datos[cont].npasaj);
write(' Alcabala : ');
readln(datos[cont].alcabala);
write(' Fecha d/m/a : ');
readln(datos[cont].fecha);
writeln(' Tipo Vehiculo : 1=particulares 2=porpuesto 3=taxi',' 4=transporte publicos');
write(' Tipo Veiculo : ');
readln(datos[cont].tipovl);
write(' Accion [A]=Sale [B]=entra : ');
repeat
readln(cu);
until upcase(cu) in['A','B'];
datos[cont].salent := acion[upcase(cu)];
cont := cont + 1;
if cont > 200 then
cont := 200;
end;
procedure consulta; {PROCEDIMIENTO PARA CONSULTAR}
var
nume : string[20];
nn : integer;
enco : boolean;
begin
writeln(' ****** Consulta Entre Numero Matricula ******');
writeln;
write(' Numero : ');
readln(nume);
for nn := 1 to length(nume) do
nume[nn] := upcase(nume[nn]);
nn := 0;
enco := false;
repeat
if datos[nn].nplaca = nume then
enco := true
else
nn := nn + 1;
until (nn > cont - 1) or (enco = true);
if enco = true then
begin
clrscr;
writeln(' ***** Datos Consultados Son *****');
writeln;
writeln(' Numero Placa = ',datos[nn].nplaca);
writeln(' Numero Pasajeros = ',datos[nn].npasaj);
writeln(' Alcabala = ',datos[nn].alcabala);
writeln(' Fecha = ',datos[nn].fecha);
writeln(' Tipo Vehiculo = ',tipove[datos[nn].tipovl]);
writeln(' Sale/Entra = ',datos[nn].salent);
writeln;
writeln(' >>>>> Pulse Una Tecla <<<<<');
readkey;
end;
end;
procedure modifica;{PROCEDIMIENTO PARA MODIFICAR}
var
termina, si : boolean;
pu, tec : char;
nn : integer;
num : string[20];
begin
if cont > 0 then
begin
writeln('***** Modificacion De Datos *****');
writeln;
write(' Entre Nume Matricula : ');
readln(num);
for nn := 1 to length(num) do
num[nn] := upcase(num[nn]);
nn := 0;
si := false;
termina := false;
repeat
if datos[nn].nplaca = num then
si := true
else
nn := nn + 1;
until (nn > cont) or (si = true);
if si = true then
begin
repeat
clrscr;
writeln('*** Elija Elemento A Modificar ***');
writeln;
writeln(' A = Numero Placa ');
writeln(' B = Numero Pasajeros');
writeln(' C = Alcabala ');
writeln(' D = Fecha');
writeln(' E = Tipo Vehiculo');
writeln(' F = Sale/Entra');
writeln(' S = Nada');
writeln;
repeat
tec := upcase(readkey);
until tec in['A','B','C','D','E','F','S'];
clrscr;
case tec of
'A' : begin write(' Numero Placa : '); readln(datos[nn].nplaca); end;
'B' : begin write(' Numero Pasajeros : '); readln(datos[nn].npasaj); end;
'C' : begin write(' Alcabala : '); readln(datos[nn].alcabala); end;
'D' : begin write(' Fecha : '); readln(datos[nn].fecha); end;
'E' : begin write(' Tipo Vehiculo : '); readln(datos[nn].tipovl); end;
'F' : begin write(' Sale/Entra : '); readln(datos[nn].salent); end;
'S' : termina := true;
end;
if tec <> 'S' then
begin
writeln('** Desea Modificar Mas [S/N] **');
repeat
pu := upcase(readkey);
until pu in['S','N'];
if pu = 'N' then
termina := true;
end;
until termina = true;
end;
end
else
begin
writeln('<<<<<<< Sin Datos En Registro Pulse Una Tecla >>>>>>>>>');
readkey;
end;
end;
procedure ordena;{PROCEDIMIENTO PARA ORDENAR DATOS}
var
pu : char;
porque : string;
kk, nn : integer;
temp : regvehiculo;
begin
if cont > 1 then
begin
for kk := 0 to cont - 1 do
for nn := cont - 1 downto kk + 1 do
begin
if datos[kk].alcabala > datos[nn].alcabala then
begin
temp := datos[kk];
datos[kk] := datos[nn];
datos[nn] := temp;
end;
end;
end;
end;
procedure eliminaregistro; {PROCEDIMIENTO PARA ELIMINAR REGISTRO}
var
tt, nn : integer;
reg : regvehiculo;
placa : string[20];
sal : boolean;
pul : char;
begin
if cont > 1 then
begin
writeln(' **** Eliminacion De Un Registro ****');
writeln;
write(' Entre Numero Placa : ');
readln(placa);
for nn := 1 to length(placa) do
placa[nn] := upcase(placa[nn]);
sal := false;
nn := 0;
repeat
if datos[nn].nplaca = placa then
sal := true
else
nn := nn + 1;
until (nn > cont - 1) or (sal = true);
if sal = true then
begin
writeln('???? Se Anulara El Registro Matricula = ',datos[nn].nplaca);
writeln('****** Desea Anularlo [S/N] *******');
repeat
pul := upcase(readkey);
until pul in['S','N'];
if pul = 'S' then
begin
for tt := 0 to cont do
begin
if tt <> nn then
datos[tt] := datos[tt];
end;
cont := tt;
end;
end;
end;
end;
procedure ordenafecha(d : array of regvehiculo; num : integer);{PROCEDIMIENTO PARA ORDENAR POR FECHA}
var
j, t : integer;
auxil : regvehiculo;
begin
for j := 1 to num do
for t := num downto j + 1 do
if d[j].fecha > d[t].fecha then
begin
auxil := d[j];
d[j] := d[t];
d[t] := auxil;
end;
end;
procedure visualizatodos; {PROCEDIMIENTO PARA REPORTE}
var
tm, poe, pos, entr, sale, paso, cc : integer;
tempo : array[1..20] of regvehiculo;
conp, alca : string[20];
begin
cc := 0;
tm := 1;
poe := 0;
pos := 0;
entr := 0;
sale := 0;
if cont > 1 then
begin
ordena;
for cc := 0 to cont - 1 do
begin
if (datos[cc].fecha = datos[cc + 1].fecha) and
(datos[cc].alcabala = datos[cc + 1].alcabala) then
begin
tempo[tm] := datos[cc];
tm := tm + 1;
end
else
begin
if tm > 1 then
begin
tempo[tm] := datos[cc];
tm := tm + 1;
ordenafecha(tempo,tm - 1);
for paso := 1 to tm - 1 do
begin
if tempo[paso].salent = acion['B'] then
poe := poe + 1;
if tempo[paso].salent = acion['A'] then
pos := pos + 1;
end;
if poe > 0 then
entr := (100 * poe) div (poe + pos);
if pos > 0 then
sale := (100 * pos) div (poe + pos);
writeln(' Alcabala = ',tempo[paso].alcabala);
writeln;
writeln(' Fecha Entran Salen %entran %salen');
writeln(tempo[paso].fecha,' ',poe,' ',pos,' ',entr,' ',sale);
writeln;
writeln(' Fechas = ',tm - 1);
end
else
begin
if datos[cc].salent = acion['B'] then
poe := poe + 1;
if datos[cc].salent = acion['A'] then
pos := pos + 1;
if poe > 0 then
entr := (100 * poe) div (poe + pos);
if pos > 0 then
sale := (100 * pos) div (poe + pos);
writeln(' Alcabala = ',datos[cc].alcabala);
writeln;
writeln(' Fecha Entran……. Salen……entran…..salen');
writeln(datos[0].fecha,' ',poe,' ',pos,' ',entr,' ',sale);
writeln;
end;
tm := 1;
poe := 0;
pos := 0;
entr := 0;
sale := 0;
end;
end;
end
else
begin
clrscr;
writeln(' Alcabala = ',datos[0].alcabala);
writeln;
if datos[0].salent = acion['B'] then
begin
entr := 1;
end
else
begin
entr := 0;
poe := 0;
end;
if datos[0].salent = acion['A'] then
begin
sale := 1;
end
else
begin
sale := 0;
pos := 0;
end;
if entr > 0 then
poe := (100 * entr) div (entr + sale);
if sale > 0 then
pos := (100 * sale) div (sale + entr);
writeln(' Fecha...Entran...... Salen.....entran...salen');
writeln(datos[0].fecha,' ',entr,' ',sale,' ',poe,' ',pos);
writeln;
end;
readkey;
end;
procedure menu;{PROCEDIMIENTO D MENU PRINCIPAL}
var
sal : boolean;
pul : char;
begin
textcolor(white);
sal := false;
cont := 0;
repeat
clrscr;
writeln(' **** Menu General ****');
writeln;
writeln(' 1 = Incluir');
writeln(' 2 = Consultar');
writeln(' 3 = Modificar');
writeln(' 4 = Eliminar');
writeln(' 5 = Reporte de estadisticas');
writeln(' 6 = Salida');
writeln;
writeln(' *** Elija Opcion ***');
repeat
pul := readkey;
until pul in['1','2','3','4','5','6'];
clrscr;
textcolor(yellow);
case pul of
'1' : entrada_datos;
'2' : consulta;
'3' : modifica;
'4' : eliminaregistro;
'5' : visualizatodos;
'6' : sal := true;
end;
until sal = true;
end;
begin
menu;
end.
adjunto las especificaciones del trabajo le agradeceria que me ayuden en la parte de los menus que piden en el trabajo y si el metodo de ordenacion esta bien.. gracias
- 323tp.zip(32,6 KB)
Valora esta pregunta


1