Pascal/Turbo Pascal - ayuda con proyecto

 
Vista:

ayuda con proyecto

Publicado por lorena (7 intervenciones) el 19/02/2014 21:59:54
Ayuda con proyecto, es urgente... me mandaron a hacer 3 diccionarios de idiomas ya los tengo.. pero tambien me mandaros a colocar en el menu una funcion o un procedimiento que dijera si el usuario quiere agregar idiomas y no hallo como hacerlo... tambien otra opcion de inicializarlos, osea borrar todo los diccionarios y los idiomas...
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

ayuda con proyecto

Publicado por ramon (2158 intervenciones) el 21/02/2014 14:04:10
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
{No se si esto te ayudara debe rías dar mas información de lo que tienes y quieres suerte}
 
 procedure menu;
 var
   sal : boolean;
   tecla : char;
 begin
    sal := false;
   repeat
      clrscr;
   writeln('***** Menu Diccionario Idiomas *****');
   writeln;
   writeln('   1 = Consultar Diccionario');
   writeln('   2 = Ampliar Diccionario');
   writeln('   3 = Salir');
   writeln;
   writeln('>>>> Elije Opcion <<<<<');
   repeat
      tecla := readkey;
   until tecla in['1','2','3'];
   clrscr;
  case tecla of
 '1' : begin
       writeln('A qui pondrias el procedimiento de consultas');
       readkey;
       end;
 '2' : begin
       writeln('A qui pondrias el procedimiento de ampliar');
       readkey;
       end;
 '3' : sal := true;
  end;
   until sal = true;
 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

ayuda con proyecto

Publicado por lorena (7 intervenciones) el 21/02/2014 21:58:11
me mandaron a hacer 3 diccionarios de idiomas con archivos y registros, luego de mostrar los diccionarios, tengo q tener la opción de borrar todos los diccionarios y todos los idiomas y tambien la opcion de agregar uno nuevo...mas o menos asi como tu lo colocaste seria asi.
procedure menu;
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
var
   sal : boolean;
   tecla : char;
 begin
    sal := false;
   repeat
      clrscr;
   writeln('***** Menu Diccionario Idiomas *****');
   writeln;
   writeln('   1 = Consultar Diccionarios');
   writeln('   2 = Agregar un nuevo idioma');
   writeln(' 3 = borrar todos los diccionarios y todos los idiomas');
   writeln('   3 = Salir');
   writeln;
   writeln('>>>> Elije Opcion <<<<<');
   repeat
      tecla := readkey;
   until tecla in['1','2','3'];
   clrscr;
  case tecla of
 '1' : begin
       writeln('A qui pondría el procedimiento de consultas'); esto ya lo tengo
       readkey;
       end;
 '2' : begin
       writeln('A qui pondría el procedimiento agregar idioma nuevo'); **este procedimiento es el q no logro hacer***
       readkey;
       end;
'3' : begin
       writeln('aqui pondría el procedimiento de borrar');  ***y este tampoco***
 '4' : sal := true;
  end;
   until sal = true;
 end;

cualquier ayuda... graciias de antemano.
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

ayuda con proyecto

Publicado por ramon (2158 intervenciones) el 24/02/2014 11:01:51
De acuerdo pero para poder ayudarte necesito mas información del tema por ejemplo como tienes estructurado el
diccionario o sea como lo guardaste en disco su estructura podría ser una cadena de texto por linea, o un registro
por ejemplo
dicci = record
frase : string[100]; para esp y
resp : string[100]; para ing
end.

como puedes apreciar si no me das mas información no puedo hazer demasiado espero me digas algo.
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

ayuda con proyecto

Publicado por lorena (7 intervenciones) el 24/02/2014 18:59:40
lo tengo asii... para los idiomas en un registro y el diccionario es un archivo.
MI profe coloco en el enunciado...
***Cada diccionario de cada idioma debe estar almacenado en un archivo diferente.
****Siempre pueden agregarse idiomas, se deben manejar al menos 3 diccionarios: Español mas 2 idiomas, los que usted desee.
****Inicializar el traductor: Borra todos los diccionarios y todos los idiomas.

yo lo e puesto asi... x ejemplo el de idioma español .. Con los registros
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
type
    espanol = record
                palabra:string;
                significado:string;
 
              end;
   ingles = record
 
                esp : string;
                ingl : string;
            end;
   frances = record
 
                esp : string;
                fran : string;
            end;
 
 
var
               espa:espanol;
               ingle : ingles;
               france : frances;

y en el archivo q es para el diccionario..

1
2
3
4
5
6
7
8
9
type
    dicE = file of espanol;
     dicI = file of ingles;
     dicF = file of frances;
 
var
      diccE:dicE;
     diccI:dicI;
     diccF:dicF;
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

ayuda con proyecto

Publicado por ramon (2158 intervenciones) el 25/02/2014 11:57:06
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
385
386
387
388
{A ver si esto te sirve te e puesto modificación también}
 
program diccionarios;
 uses
    crt;
  type
   espanol = record
          palabra : string;
      significado : string;
          end;
 
  ingles = record
       esp : string;
      ingl : string;
     end;
 
   frances = record
       esp : string;
      fran : string;
     end;
 
  const
     aespa = 'elespano.dat';
     aingl = 'elingles.dat';
     afran = 'elfrance.dat';
 
 
var
   espa : espanol;
  ingle : ingles;
 france : frances;
   dicE : file of espanol;
   dicI : file of ingles;
   dicF : file of frances;
 
   procedure entrada_datos(cual : char);
   var
     nombre : string;
   begin
      clrscr;
      if upcase(cual) = 'E' then
      begin
         nombre := aespa;
         write('  Entre Palabra     : ');
         readln(espa.palabra);
         write('  Entre Significado : ');
         readln(espa.significado);
      end;
      if upcase(cual) = 'I' then
      begin
         nombre := aingl;
         write('  Entre Palabra En Espanol : ');
         readln(ingle.esp);
         write('  Entre Palabra En Ingles  : ');
         readln(ingle.ingl);
      end;
      if upcase(cual) = 'F' then
      begin
         nombre := afran;
         write('  Entre Palabra En Espanol : ');
         readln(france.esp);
         write('  Entre Palabra En Frances : ');
         readln(france.fran);
      end;
   case  upcase(cual) of
 'E' : begin
         assign(dicE,nombre);
      {$I-} reset(dicE); {$I+}
      if ioresult <> 0 then
      begin
         rewrite(dicE);
         seek(dicE,0);
         write(dicE,espa);
         close(dicE);
      end
   else
       begin
          seek(dicE,filesize(dicE));
          write(dicE,espa);
         close(dicE);
       end;
      end;
 'I' : begin
        assign(dicI,nombre);
      {$I-} reset(dicI); {$I+}
      if ioresult <> 0 then
      begin
         rewrite(dicI);
         seek(dicI,0);
         write(dicI,ingle);
         close(dicI);
      end
   else
       begin
         seek(dicI,filesize(dicI));
         write(dicI,ingle);
         close(dicI);
       end;
       end;
 'F' : begin
         assign(dicF,nombre);
      {$I-} reset(dicF); {$I+}
      if ioresult <> 0 then
      begin
         rewrite(dicf);
         seek(dicf,0);
         write(dicf,france);
         close(dicf);
      end
   else
       begin
         seek(dicf,filesize(dicf));
         write(dicf,france);
         close(dicf);
       end;
     end;
   end;
 end;
 
 procedure modifica_datos(cual : char);
 var
   frase, nombre : string;
   pos, i : longint;
   esta : boolean;
   pul : char;
  begin
     clrscr;
     if upcase(cual) = 'E' then
     begin
        nombre := aespa;
        assign(dicE,nombre);
      {$I-} reset(dicE); {$I+}
      if ioresult <> 0 then
      begin
          writeln('  Error De Archivo o No Existe ');
          writeln;
          writeln('  Pulse Una Tecla ');
          readkey;
      end
    else
       begin
         write('  Entre Frase a Modificar : ');
         readln(frase);
       end;
     end;
     if upcase(cual) = 'I' then
     begin
        nombre := aingl;
        assign(dici,nombre);
      {$I-} reset(dici); {$I+}
      if ioresult <> 0 then
      begin
          writeln('  Error De Archivo o No Existe ');
          writeln;
          writeln('  Pulse Una Tecla ');
          readkey;
      end
    else
       begin
         write('  Entre Frase a Modificar : ');
         readln(frase);
       end;
     end;
     if upcase(cual) = 'F' then
     begin
        nombre := afran;
        assign(dicf,nombre);
      {$I-} reset(dicf); {$I+}
      if ioresult <> 0 then
      begin
          writeln('  Error De Archivo o No Existe ');
          writeln;
          writeln('  Pulse Una Tecla ');
          readkey;
      end
    else
       begin
         write('  Entre Frase a Modificar : ');
         readln(frase);
       end;
     end;
    case upcase(cual) of
  'E' : begin
           esta := false;
           pos := 0;
           for i := 0 to filesize(dicE) - 1 do
           begin
              seek(dicE,i);
              read(dicE,espa);
              if espa.palabra = frase then
              begin
                 esta := true;
                 pos := i;
                 break;
              end;
           end;
           if esta = true then
           begin
              clrscr;
              write('  Entre Palabra     : ');
              readln(espa.palabra);
              write('  Entre Significado : ');
              readln(espa.significado);
              writeln;
              writeln(' Desea Realizar El Cambio S/N ');
               repeat
                  pul := upcase(readkey);
               until pul in['S','N'];
              if pul = 'S' then
              begin
                 seek(dicE,pos);
                 write(dicE,espa);
              end;
           end
         else
           begin
              writeln('  Dato No Encontrado Pulse Una Tecla');
              readkey;
           end;
           close(dicE);
        end;
  'I' : begin
           esta := false;
           pos := 0;
           for i := 0 to filesize(dici) - 1 do
           begin
              seek(dici,i);
              read(dici,ingle);
              if ingle.esp = frase then
              begin
                 esta := true;
                 pos := i;
                 break;
              end;
           end;
           if esta = true then
           begin
              clrscr;
                write('  Entre Palabra En Espanol : ');
                readln(ingle.esp);
                write('  Entre Palabra En Ingles  : ');
                readln(ingle.ingl);
                writeln;
                writeln(' Desea Realizar El Cambio S/N ');
               repeat
                  pul := upcase(readkey);
               until pul in['S','N'];
              if pul = 'S' then
              begin
                 seek(dici,pos);
                 write(dici,ingle);
              end;
           end
         else
           begin
              writeln('  Dato No Encontrado Pulse Una Tecla');
              readkey;
           end;
           close(dici);
        end;
  'F' : begin
           esta := false;
           pos := 0;
           for i := 0 to filesize(dicf) - 1 do
           begin
              seek(dicf,i);
              read(dicf,france);
              if france.esp = frase then
              begin
                 esta := true;
                 pos := i;
                 break;
              end;
           end;
           if esta = true then
           begin
                 clrscr;
                 write('  Entre Palabra En Espanol : ');
                 readln(france.esp);
                 write('  Entre Palabra En Frances : ');
                 readln(france.fran);
                 writeln;
                 writeln(' Desea Realizar El Cambio S/N ');
               repeat
                  pul := upcase(readkey);
               until pul in['S','N'];
              if pul = 'S' then
              begin
                 seek(dicf,pos);
                 write(dicf,france);
              end;
           end
         else
           begin
              writeln('  Dato No Encontrado Pulse Una Tecla');
              readkey;
           end;
           close(dicf);
        end;
    end;
  end;
 
  procedure limpia_Diccionarios;
  var
    bb : char;
    nombre : string;
  begin
      clrscr;
      writeln('>>>>>> Desea Eliminar Los Diccionarios S/N <<<<<<');
      repeat
          bb := upcase(readkey);
      until bb in['S','N'];
    if bb = 'S' then
    begin
      assign(dicE,nombre);
      {$I-} reset(dicE); {$I+}
      if ioresult = 0 then
      begin
         close(dicE);
         erase(dicE);
      end;
      assign(dicI,nombre);
      {$I-} reset(dicI); {$I+}
      if ioresult = 0 then
      begin
         close(dicI);
         erase(dicI);
      end;
      assign(dicF,nombre);
      {$I-} reset(dicF); {$I+}
      if ioresult = 0 then
      begin
         close(dicF);
         erase(dicF);
      end;
    end;
  end;
 
   procedure menu;
   var
     letra, tec : char;
     sal : boolean;
   begin
      sal := false;
    repeat
        clrscr;
        writeln('***** Menu Jeneras *****');
        writeln;
        writeln('  1 = Entrada Diccionario');
        writeln('  2 = Anular Diccionarios');
        writeln('  3 = Entrar Nuevos Datos');
        writeln('  4 = Modificar Datos');
        writeln('  5 = Salir');
        writeln;
        writeln('<<<< Elija Opcion >>>>');
       repeat
        tec := readkey;
       until tec in['1','2','3','4','5'];
       clrscr;
   case tec of
 '1' : begin
          write('  Entre Que Diccionario [E/I/F]');
          readln(letra);
          entrada_datos(letra);
       end;
 '2' : begin
          limpia_Diccionarios;
       end;
 '3' : begin
          write('  Entre En Que Diccionario [E/I/F]');
          readln(letra);
          entrada_datos(letra);
       end;
 '4' : begin
          write('  Entre Diccionario A Modificar [E/I/F]');
          readln(letra);
          modifica_datos(letra);
       end;
 '5' : sal := true;
   end;
    until sal = true;
 end;
 
 
 
  begin
     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
1
Comentar

ayuda con proyecto

Publicado por lorena (7 intervenciones) el 05/03/2014 16:40:16
Muchasss gracias por tu ayuda ... Pero en el momentos de q me elimina los diccionarios me elimina los idiomas también?
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

ayuda con proyecto

Publicado por ramon (2158 intervenciones) el 06/03/2014 10:31:26
Si limpia todo anula el borrado del archivo

1
2
3
4
5
6
7
assign(dicI,nombre);
      {$I-} reset(dicI); {$I+}
      if ioresult = 0 then
      begin
         close(dicI);
         erase(dicI);
      end;

y listo
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

ayuda con proyecto

Publicado por lorena (7 intervenciones) el 06/03/2014 22:00:45
Muchas graciias :D
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