Pascal/Turbo Pascal - como puedo manejar este archivo? en mi compilador sale 'ilegal xprsion' cuando creo un procedimient,

 
Vista:
sin imagen de perfil

como puedo manejar este archivo? en mi compilador sale 'ilegal xprsion' cuando creo un procedimient,

Publicado por kristhian (5 intervenciones) el 02/06/2016 19:16:26
un programa que permita llevar el registro de las discotecas y bares de la Isla de Margarita, dicha información debe ser almacenada en un archivo denominado “directorio.txt”. El programa debe permitir realizar las siguientes acciones:
Agregar un nuevo local al archivo: de cada local se debe guardar los siguientes datos: nombre del local, nombre del encargado, Rif del local, dirección, tipo (bar o discoteca), horario de apertura y horario de cierre. Debe validar que no existan locales repetidos.
Modificar los datos de todos los locales, se les debe minimizar o incrementar en uno (depende lo que requiera el usuario), la hora de cierre.
Listar todos los locales dentro de una categoría (bar o discoteca) indicada por el usuario.
Mostrar todas las discotecas que cierran después de una hora indicada por el usuario.
Eliminar todos los locales que trabajen menos de 3 horas.
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

como puedo manejar este archivo? en mi compilador sale 'ilegal xprsion' cuando creo un procedimient,

Publicado por ramon (2158 intervenciones) el 02/06/2016 21:45:25
tiene que ser un archivo de texto no de registros mira que no es lo mismo.
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

como puedo manejar este archivo? en mi compilador sale "ilegal xprsion" cuando creo un procedimient,

Publicado por ramon (2158 intervenciones) el 05/06/2016 22:58:03
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
{Mira esto te servirá de ayuda  }
 
program controllocales;
 uses
    crt;
  const
    eltipo : array[1..2] of string[4] = (
    ('Bar'),('Disc'));
    archivotext = 'directorio.txt';
    archivoregi = 'directorio.dat';
 
  type
    local = record
          nomb_local : string[80];
          nomb_encargado : string[80];
          Rif_local : longint;
          direccion : string[60];
          tipo : string[4];
          hora_apertura : integer;
          hora_cierre : integer;
        end;
 
    var
      ftext : text;
      freg : file of local;
      datos : local;
      datotext : string;
 
 
    procedure guardadatos(d : local; como : char);
    var
      cambitexto : string;
      s : string[8];
      r1, r2 : string[6];
    begin
      if upcase(como) = 'R'  then
      begin
         assign(freg,archivoregi);
      {$I-} reset(freg); {$I+}
      if ioresult <> 0 then
      begin
         rewrite(freg);
         seek(freg,0);
         write(freg,d);
         close(freg);
      end
   else
      begin
         seek(freg,filesize(freg));
         write(freg,d);
         close(freg);
      end;
     end;
      if upcase(como) = 'T' then
      begin
      assign(ftext,archivotext);
      {$I-} reset(ftext); {$I+}
      if ioresult <> 0 then
      begin
         with d do
         begin
        str(Rif_local,s);
        str(hora_apertura,r1);
        str(hora_cierre,r2);
      cambitexto := (nomb_local + ' ' + nomb_encargado + ' ' + s +
' ' + direccion + ' ' + tipo + ' ' + r1 + ' ' + ' ' + r2);
         end;
         rewrite(ftext);
         writeln(ftext,cambitexto);
         close(ftext);
      end
    else
        begin
           close(ftext);
           with d do
         begin
         str(Rif_local,s);
         str(hora_apertura,r1);
         str(hora_cierre,r2);
      cambitexto := (nomb_local + ' ' + nomb_encargado + ' ' + s +
' ' + direccion + ' ' + tipo + ' ' + r1 + ' ' + ' ' + r2);
         end;
           append(ftext);
           writeln(ftext,cambitexto);
           close(ftext);
        end;
      end;
   end;
 
   procedure presentadatos(como : char);
   var
      reg, ar : longint;
      eltext : string;
   begin
      if upcase(como) = 'R' then
      begin
         assign(freg,archivoregi);
      {$I-} reset(freg); {$I+}
      if ioresult <> 0 then
      begin
         writeln('   Error de archivo O No Existe Pulse Una Tecla');
         readkey;
      end
   else
        begin
           clrscr;
           reg := filesize(freg) - 1;
           for ar := 0 to filesize(freg) - 1 do
           begin
           seek(freg,ar);
           read(freg,datos);
           with datos do
           begin
           writeln('  Nombre Local     = ',nomb_local);
           writeln('  Nombre Encargado = ',nomb_encargado);
           writeln('  Rif Local        = ',Rif_local);
           writeln('  Tipo Local       = ',tipo);
           writeln('  Hora Apertura    = ',hora_apertura);
           writeln('  Hora Cierre      = ',hora_cierre);
           writeln;
           writeln('    Pulse Una Tecla Para Continuar Registros = ',reg + 1);
           readkey;
           clrscr;
           end;
          end;
           close(freg);
        end;
      end;
       if upcase(como) = 'T' then
       begin
          assign(ftext,archivotext);
      {$I-} reset(ftext); {$I+}
      if ioresult <> 0 then
      begin
         writeln('   Error de archivo O No Existe Pulse Una Tecla');
         readkey;
      end
    else
        begin
           clrscr;
           while not eof(ftext) do
           begin
              readln(ftext,eltext);
              writeln(eltext);
           end;
           close(ftext);
        end;
       end;
   end;
 
    procedure entradadatos(como : char);
    var
       tec : char;
    begin
       clrscr;
       writeln('   ****** Entrada De Datos Del Local ******');
       writeln;
       write('   Nombre Locar     : ');
       readln(datos.nomb_local);
       write('   Nombre Encargado : ');
       readln(datos.nomb_encargado);
       write('   Rif Local        : ');
       readln(datos.Rif_local);
       write('   Tipo De Local [ 1=Bar / 2=Discoteca ] : ');
       repeat
           tec := readkey;
       until tec in['1','2'];
       if tec = '1' then
       datos.tipo := eltipo[1];
       if tec = '2' then
       datos.tipo := eltipo[2];
       write(datos.tipo);
       writeln;
       write('   Hora De Apertura : ');
       readln(datos.hora_apertura);
       write('   Hora De Cierre   : ');
       readln(datos.hora_cierre);
       writeln;
       writeln('   Datos Correctos [S/N]');
       repeat
           tec := upcase(readkey);
       until tec in['S','N'];
       if tec = 'S' then
       begin
          guardadatos(datos,como)
       end;
     end;
 
 
 
 
   begin
      {Modifica [T] por [R] para registros}
      entradadatos('R');
      presentadatos('R');
      readkey;
   end.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
1
Comentar
sin imagen de perfil

como puedo manejar este archivo? en mi compilador sale 'ilegal xprsion' cuando creo un procedimient,

Publicado por 1234maco (5 intervenciones) el 05/06/2016 23:36:53
Gracias..........
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