Pascal/Turbo Pascal - De Pascal a psudocodigo

 
Vista:

De Pascal a psudocodigo

Publicado por Jose Leonardo (1 intervención) el 29/01/2014 22:20:33
Buenas tardes, quiero saber si pueden ayudarme a pasar un código de pascal a Pseudocodigo, el código es el siguiente.

Gracias de antemano.

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
program Estadistica;
  uses
     crt;
  const
32 : array[1..4] of string[20] = ('Particular','Por Puesto','Taxi','Transporte Publico');
     acion : array['A'..'B'] of string[5] = ('Entra','Sale');
  type
     regvehiculo = record
           nplaca : string[20];
           npasaj : integer;
         alcabala : string[20];
            fecha : string[10];
           tipovl : byte;
           salent : char;
           end;
 
   var
     datos : array[0..200] of regvehiculo;
     cont : integer;
     tecla : char;
 
   procedure IngresarDatos;
   var
      d : integer;
   begin
      writeln('***** INgreso de Nuevo Registro *****');
      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('  Cantidad de Pasajeros         : ');
      readln(datos[cont].npasaj);
      write('  ID Alcabala                 : ');
      readln(datos[cont].alcabala);
      write('  Fecha (dd/mm/aa)              : ');
      readln(datos[cont].fecha);
    writeln(' Tipo de Vehiculo : 1 = Particular  2 = Por Puesto  3 = Taxi',
                           '  4 = Transporte Publico');
      write('  Tipo de Vehiculo             : ');
      readln(datos[cont].tipovl);
      write(' Accion [A] = Saliendo [B] = Entrando : ');
      readln(datos[cont].salent);
      datos[cont].salent := upcase(datos[cont].salent);
      cont := cont + 1;
      if cont > 200 then
      cont := 200;
   end;
 
   procedure ConsultarDatos;
   var
   nume : string[20];
   nn : integer;
   enco : boolean;
   begin
      writeln(' ****** Consultar: Ingresar 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       = ',acion[datos[nn].salent]);
       writeln;
       writeln('   >>>>> Pulse Una Tecla <<<<<');
       readkey;
    end;
   end;
 
   procedure ModificarDatos;
   var
     termina, si : boolean;
     pu, tec : char;
     nn : integer;
     num : string[20];
   begin
      if cont > 0 then
      begin
      writeln('***** Modificar Datos *****');
      writeln;
      write('   Ingrese Numero de 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('*** 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 Otros [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 OrdenarDatos;
   var
     pu : char;
     porque : string;
     kk, nn : integer;
     temp : regvehiculo;
    begin
        if cont > 2 then
        begin
        clrscr;
        writeln('  **** Ordenar Registros Por ****');
        writeln;
        writeln('   1 = Fecha y placa del vehiculo');
        writeln('   2 = Alcabala y fecha');
        writeln('   3 = Placa del vehiculo');
        writeln('   4 = alcabala y tipo de vehiculo');
        writeln;
        writeln('  <<<< Elija Opcion >>>>');
        repeat
            pu := readkey;
        until pu in['1','2','3','4'];
     if pu = '1' then
     begin
         for kk := 0 to cont do
           for nn := cont downto kk + 1 do
           begin
              if (datos[kk].fecha > datos[nn].fecha) and
                 (datos[kk].nplaca > datos[nn].nplaca) then
               begin
                  temp := datos[kk];
                  datos[kk] := datos[nn];
                  datos[nn] := temp;
               end;
           end;
     end;
     if pu = '2' then
     begin
          for kk := 0 to cont do
           for nn := cont downto kk + 1 do
           begin
              if (datos[kk].alcabala > datos[nn].alcabala) and
                 (datos[kk].fecha > datos[nn].fecha) then
               begin
                  temp := datos[kk];
                  datos[kk] := datos[nn];
                  datos[nn] := temp;
               end;
           end;
     end;
     if pu = '3' then
     begin
         for kk := 0 to cont do
           for nn := cont downto kk + 1 do
           begin
              if (datos[kk].nplaca > datos[nn].nplaca) then
               begin
                  temp := datos[kk];
                  datos[kk] := datos[nn];
                  datos[nn] := temp;
               end;
           end;
     end;
     if pu = '4' then
     begin
          for kk := 0 to cont do
           for nn := cont downto kk + 1 do
           begin
              if (datos[kk].alcabala > datos[nn].alcabala) and
                 (datos[kk].tipovl > datos[nn].tipovl) then
               begin
                  temp := datos[kk];
                  datos[kk] := datos[nn];
                  datos[nn] := temp;
               end;
           end;
       end;
      end
    else
       begin
         writeln('<<<<<<< Sin Datos En Registro Pulse Una Tecla >>>>>>>>>');
         readkey;
       end;
   end;
 
   procedure EliminarDatos;
   var
     tt, nn : integer;
     reg : regvehiculo;
     placa : string[20];
     sal : boolean;
     pul : char;
   begin
      if cont > 1 then
      begin
      writeln('  **** Eliminar Registro ****');
      writeln;
      write('   Ingrese 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 - 1 do
         begin
            if tt <> nn then
            datos[tt] := datos[tt];
         end;
           cont := tt;
      end;
     end;
    end
  else
      begin
         writeln('<<<<<<< Sin Datos En Registro Pulse Una Tecla >>>>>>>>>');
         readkey;
      end;
   end;
 
   procedure VisualizarRegistros;
   var
     paso, cc : integer;
   begin
      cc := 0;
      paso := 1;
      writeln('***** Las Datos Son *****');
      writeln;
    repeat
       writeln(datos[cc].nplaca,'  ',datos[cc].npasaj,'  ',
               datos[cc].alcabala,'  ',datos[cc].fecha,'  ',
               datos[cc].tipovl,'  ',datos[cc].salent);
       paso := paso + 1;
       cc := cc + 1;
       if paso > 24 then
       begin
          writeln('***** Pulse Una Tecla Para Continuar ******');
          readkey;
          clrscr;
          writeln('***** Las Datos Son *****');
          writeln;
          paso := 1;
       end;
    until cc > cont - 1;
    writeln;
    writeln('<<<<<< Fin De Presentacion Pulse Una Tecla >>>>>>');
    readkey;
   end;
 
 
   procedure menu;
   var
     sal : boolean;
     pul : char;
   begin
      sal := false;
    repeat
        clrscr;
        writeln('    **** Menu General ****');
        writeln;
        writeln('         1  = Incluir Registro');
        writeln('         2  = Consultar Datos');
        writeln('         3  = Modificar Registro');
        writeln('         4  = Ordenar Por: (Criterio)');
        writeln('         5  = Eliminar Registros');
        writeln('         6  = Reporte de estadisticas');
        writeln('         7  = Salir');
        writeln;
        writeln('    *** Elija Opcion ***');
        repeat
            pul := readkey;
        until pul in['1','2','3','4','5','6','7'];
        clrscr;
     case pul of
  '1' : IngresarDatos;
  '2' : ConsultarDatos;
  '3' : ModificarDatos;
  '4' : OrdenarDatos;
  '5' : EliminarDatos;
  '6' : VisualizarRegistros;
  '7' : sal := true;
    end;
  until sal = true;
  end;
 
   begin
      cont := 0;
      menu;
   end.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder