Pascal/Turbo Pascal - AYUDA CON CODIGO PARA GENERAR UN LISTADO

 
Vista:
sin imagen de perfil

AYUDA CON CODIGO PARA GENERAR UN LISTADO

Publicado por lisbeth (10 intervenciones) el 03/07/2017 15:57:41
BUEN DIA TENGO ESTE PROBLEMA QUE ME HACE FALTA GENERAR EL LISTADO DE EMPLEANDO DE ESTA FORMA.

generar el listado se debe considerar lo siguiente:
 La Edad del empleado se debe obtener a partir de su fecha de nacimiento y la
fecha actual, tomando como fecha actual el 31/01/2017.
 El nivel salarial del empleado está en función de su sueldo.

ESTE ES EL PROGRAMA

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
program Una_tec;
  uses
     crt;
  type
    nominadeemplea = record
 
                    civ: longint;
                 nombr : string[10];
                 apell : string[10];
                  fechn: string[10];
                  edad : longint;
                 Sueld : real;
                 nivel : integer;
                  tsn1 : real;
                  tsn2 : real;
                  tsn3 : real;
                  tsge : real;
                 end;
 
   const
      emplea = 6;
  var
    datosempl : array[1..emplea] of  nominadeemplea;
    t, cont : integer;
    tec : char;
    com : real;
    nivelreg : array[1..emplea] of real;
    oremple : longint;
 
  procedure incluir;
  begin
      clrscr;
      writeln('**** Entrada De Datos Del Empleado ****');
      writeln;
      write('     Cedula de Identidad del Empleado     : ');
      readln(datosempl[cont].civ);
      clrScr;
      write('     Nombre del Empleado      : ');
      readln(datosempl[cont].nombr);
      clrScr;
      write('     Apellido del Empleado   : ');
      readln(datosempl[cont].apell);
      clrScr;
      writeln(' --Ingrese Fecha de Nacimiento del Empleado-- ');
      writeln(' <<<Por favor que se en formato dd/mm/aaaa>>> ');
      write('          Digite la fecha por favor           : ');
      readln(datosempl[cont].fechn);
      write('     Ingrese la Edad del Empleado        :');
      readln(datosempl[cont].edad);
      clrScr;
      write('     Ingrese el Sueldo Actual del Empleado      : ');
      readln(datosempl[cont].Sueld);
      clrScr;
      writeln('              <<<Ingrese el nivel salarial del empleado>>>        ');
      writeln;
      writeln(' Recuerde: Que si sueldo se encuentra entre:[15000,..,19999.99] oprimir "1"   ');
      writeln(' Recuerde: Que si sueldo se encuentra entre:[20000,..,24999.99] oprimir "2"   ');
      writeln(' Recuerde: Que si sueldo se encuentra entre:[25000,..,29999.99] oprimir "3"   ');
      writeln;
      write('                     Digite el nivel por favor:');
      readln(datosempl[cont].nivel);
   end;
 
 
  procedure modificar(codi : longint);
  var
    pul : char;
    modi : boolean;
  begin
     modi := false;
     for t := 1 to cont do
     begin
        if datosempl[t].civ = codi then
        begin
           modi := true;
           break;
        end;
     end;
      if modi = true then
      begin
         repeat
         clrscr;
         writeln('**** Modificacion De Datos ****');
         writeln;
         writeln('  1 = Cedula del Empleado');
         writeln('  2 = Nombre');
         writeln('  3 = Apellido');
         writeln('  4 = Fecha de Nacimiento');
         writeln('  5 = Edad');
         writeln('  6 = Sueldo ');
         writeln('  7 = Nivel Salarial');
         writeln('  8 = Salir');
         repeat
             pul := readkey;
         until pul in[#49..#56];
      case pul of
     #49 : begin
           write('  Cedula de Identidad     : ');
           readln(datosempl[t].civ);
           end;
     #50 : begin
           write('  Ingrese Nombre        : ');
           readln(datosempl[t].nombr);
           end;
     #51 : begin
           write('  Ingrese Apellido     : ');
           readln(datosempl[t].apell);
           end;
     #52 : begin
           write('  Ingrese Fecha de Nacimiento     : ');
           readln(datosempl[t].fechn);
           end;
     #53 : begin
           write('  Ingrese Edad         : ');
           readln(datosempl[t].edad);
           end;
     #54 : begin
           write('  Ingrese Sueldo       : ');
           readln(datosempl[t].Sueld);
           end;
     #55 : begin
           write('  Ingrese Nivel Salarial     : ');
           readln(datosempl[t].nivel);
           end;
      end;
    until pul = #56;
    end
   else
      begin
         clrscr;
         writeln('  Error Opcion NO DISPONIBLE, Pulse [Enter]');
         readln;
      end;
  end;
 
  procedure eliminar(codi : longint);
  var
    pul : char;
    borra : boolean;
    corre : integer;
  begin
     borra := false;
     for t := 1 to cont do
     if datosempl[t].civ = codi then
     begin
        borra := true;
        break;
     end;
     if borra = true then
     begin
        clrscr;
        writeln('<<<<<<<< Anular Registro del Empleado >>>>>>>>>>');
        writeln;
        writeln('  Codigo Vendedor     = ',datosempl[t].civ);
        writeln;
        writeln('Desea Anular Este Empleado [S/N]');
        repeat
           pul := upcase(readkey);
        until pul in['S','N'];
        if pul = 'S' then
        begin
           fillchar(datosempl[t],sizeof(datosempl[t]),0);
           corre := 1;
           for corre := t to cont do
           if datosempl[corre].civ > 0 then
           begin
              datosempl[corre] := datosempl[corre - 1];
           end;
            cont := cont - 1;
        end;
     end
   else
      begin
         clrscr;
         writeln('  Error Opcion NO DISPONIBLE, Pulse [Enter]');
         readln;
      end;
  end;
 
  procedure ordenaarray(por : char);
  var
    temp : nominadeemplea;
    g, r : integer;
    bontem : real;
  begin
     if upcase(por) = 'N' then  {Ordenado de menor a mayor nivel}
     begin
        for g := 1 to cont do
          for r := cont downto g + 1 do
          if datosempl[g].nivel > datosempl[r].nivel then
          begin
             temp := datosempl[g];
             datosempl[g] := datosempl[r];
             datosempl[r] := temp;
             bontem := nivelreg[g];
             nivelreg[g] := nivelreg[r];
             nivelreg[r] := bontem;
          end;
       end;
   end;
 
  procedure menu;
  var
    tee : char;
    sas : boolean;
  begin
     sas := false;
   repeat
      clrscr;
      writeln('******* Menu General *********');
      writeln;
      writeln('   1 = INGRESAR');
      writeln('   2 = MODIFICAR');
      writeln('   3 = ELIMINAR');
      writeln('   4 = ORDENAR REGISTRO');
      writeln('   5 = SALIR');
      writeln;
      writeln('<<<<< Elija Opcion >>>>>');
      repeat
         tee := readkey;
      until tee in[#49..#54];
  case tee of
 #49 : begin
         clrscr;
         cont := cont + 1;
         if cont > emplea then
         cont := emplea;
         incluir;
        end;
 #50 : begin
          clrscr;
          write('   Ingrese cedula del empleado : ');
          readln(oremple);
          consultar(oremple);
       end;
 #51 : begin
          clrscr;
          write('   Ingrese cedula del empleado : ');
          readln(oremple);
          modificar(oremple);
       end;
 #52 : begin
          clrscr;
          write('   Ingrese cedula del empleado : ');
          readln(oremple);
          eliminar(oremple);
       end;
 #53 : begin
          clrscr;
          writeln(' Ordenar Por nivel y por cedula de identidad presioe[N]');
          repeat
             tec := upcase(readkey);
          until tec in['N'];
          ordenaarray(tec);
       end;
 #54 : sas := true;
   end;
   until sas = 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