Pascal/Turbo Pascal - ARCHIVOS DE TEXTO

 
Vista:
Imágen de perfil de edwin murillo amador

ARCHIVOS DE TEXTO

Publicado por edwin murillo amador (6 intervenciones) el 27/03/2014 04:23:28
ESTIMADO PROGRAMADOR, TENGO EL SIGUIENTE EJERCICIO POR RESOLVER CON TURBO PASCAL.
ESCRIBA UN PROGRAMA QUE ACTUALICE ANUALMENTE UN ARCHIVO DE SUELDOS. CADA GRUPO DE DATOS EN EL ARCHIVO CONTIENE EL NOMBRE DE UN EMPLEADO, EL SUELDO SEMANAL Y EL NUMERO DE AÑOS EN LA EMPRESA. AL FINAL DEL AÑO, SE DEBE INCREMENTAR PRIMERO EL NUMERO DE AÑOS EN LA EMPRESA EN 1 Y DESPUES DEBEN DARSE AUMENTOS.
SI EL EMPLEADO TIENE UNA ANTIGUEDAD DE POR LO MENOS DIEZ AÑOS, RECIBE UN AUMENTO DE $3O A LA SEMANA, EN CASO CONTRARIO, EL AUMENTO ES DE SOLO $15.

AYUDEME LO MAS PRONTO POSIBLE,
ESTARE PENDIENTE
MUCHAS GRACIAS DE ANTEMANO
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
-1
Responder

ARCHIVOS DE TEXTO

Publicado por ramon (2158 intervenciones) el 28/03/2014 00:50:42
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
{Mira esto}
 
program archsueld;
  uses
     crt;
 type
    sueldos = record
           nombre : string;
           sueldo : real;
           nayos  : integer;
          end;
  var
      empleado : sueldos;
      f : file of sueldos;
 
    procedure guarda_a_disco(g : sueldos);
    begin
       assign(f,'Empleado.dat');
   {$I-} reset(f); {$I+}
   if ioresult <> 0 then
   begin
       rewrite(f);
       seek(f,0);
       write(f,g);
       close(f);
   end
 else
    begin
       seek(f,filesize(f));
       write(f,g);
       close(f);
    end;
 end;
 
    procedure entradadatos;
    begin
       with empleado do
       begin
          write('  Nombre : ');
          readln(nombre);
          write('  Sueldo : ');
          readln(sueldo);
          write('  A¤os   : ');
          readln(nayos);
       end;
        guarda_a_disco(empleado);
    end;
 
  procedure actualizaayo;
  var
    actu : longint;
   begin
     assign(f,'Empleado.dat');
   {$I-} reset(f); {$I+}
   if ioresult <> 0 then
   begin
      writeln('   Error El Archivo No Existe Pulse Una Tecla');
      readkey;
   end
 else
     begin
        for actu := 0 to filesize(f) - 1 do
        begin
           seek(f,actu);
           read(f,empleado);
           if empleado.nayos >= 10 then
           begin
              empleado.nayos := empleado.nayos + 1;
              empleado.sueldo := empleado.sueldo + (30 * 52);
              seek(f,actu);
              write(f,empleado);
           end;
           if empleado.nayos < 10 then
           begin
              empleado.nayos := empleado.nayos + 1;
              empleado.sueldo := empleado.sueldo + (15 * 52);
              seek(f,actu);
              write(f,empleado);
           end;
        end;
         close(f);
         writeln('   Actualizacion Realizada Pulse Una Tecla');
         readkey;
     end;
   end;
 
  procedure verempleados;
  var
    emp : longint;
    paso : integer;
  begin
     paso := 1;
     assign(f,'Empleado.dat');
   {$I-} reset(f); {$I+}
   if ioresult <> 0 then
   begin
      writeln('   Error El Archivo No Existe Pulse Una Tecla');
      readkey;
   end
 else
     begin
        for emp := 0 to filesize(f) - 1 do
        begin
           seek(f,emp);
           read(f,empleado);
           with empleado do
           begin
              write('   Nombre : ',nombre,'    Sueldo : ',sueldo:0:2,
              '    Antiguedad : ',nayos);
              paso := paso + 1;
              if paso > 22 then
              begin
                 writeln;
                 writeln('   Pulse Una Tecla ');
                 readkey;
                 clrscr;
                 paso := 1;
              end
            else
              writeln;
           end;
       end;
       close(f);
       writeln;
       writeln('   Pulse Una Tecla ');
       readkey;
    end;
  end;
 
  procedure menu;
  var
    tec : char;
    sal : boolean;
  begin
     sal := false;
   repeat
      clrscr;
      writeln(' ***** Menu Jeneral *****');
      writeln;
      writeln('   1 = Entrada Nuevo Empleado');
      writeln('   2 = Actualizar A¤o');
      writeln('   3 = Presentar Empleados');
      writeln('   4 = Salir');
      writeln;
      writeln('  Elija Opcion');
      repeat
         tec := readkey;
      until tec in['1','2','3','4'];
      clrscr;
   case tec of
 '1' : entradadatos;
 '2' : actualizaayo;
 '3' : verempleados;
 '4' : sal := true;
   end;
   until sal = true;
  end;
 
  begin
      clrscr;
      menu;
  end.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
Imágen de perfil de EDWIN MURILLO AMADOR

ARCHIVOS DE TEXTO

Publicado por EDWIN MURILLO AMADOR (6 intervenciones) el 12/04/2014 06:22:59
Eres un Genio, El programa esta perfecto, si en algo le puedo ayudar, estoy a sus ordenes... Muchas gracias por su ayuda es muy util para mi
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar