Pascal/Turbo Pascal - AYUDA ejercicio final pascal

 
Vista:

AYUDA ejercicio final pascal

Publicado por jorge (5 intervenciones) el 20/01/2016 09:55:51
ejercicio de arrays, solo se puede utilizar en un ejercicio variables globales (solo en las cadenas y i:=)
* un array de nombres minimo 30 posiciones de 30 caracteres
* un array apellido minimo 30 posiciones de 40 caracteres
* array bidimensional 30 notas 4 posiciones tipo real
* la posicion 1,2,3 seran notas entradas por el usuario y la posicion 4 sera la media de las notas.
* utilizaremos un array constante para el menu (entrada. listado, busqueda y bajas, ordena, modifica y finaliza, utilizar el menu de flechas)
* entrada (es lo primero que tenemos que hacer) --> tendra que estar todo controlado por medio de un procedimiento para el control de letras, tiene que ser el mismo procedimiento para el nombre y apellido solo
cambiamos la longitud.(inicio)
numeros -abra una funcion para entrar numeros, y me devolvera numero real(inicio)
Bajas y reorganizar
* busqueda por apellido
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
sin imagen de perfil

AYUDA ejercicio final pascal

Publicado por crack81 (58 intervenciones) el 22/01/2016 02:58:16
Muy bien per que llevas hecho en que se te dificulta que no sabes hacer?
la idea es aprender no hacer tu tarea
saludos
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 ejercicio final pascal

Publicado por jorge (5 intervenciones) el 22/01/2016 08:24:22
Tengo echo esto:
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
program untitled;
 
uses crt;
const
	a:array[1..3] of string[20]=('1.ENTRADA', '2.LISTADO', '3.SALIR');
	var
	i,opci:integer;
	cadnom:string[40];
	Nom:array[1..30] of string [20];
	Ape:array[1..30] of string [40];
	Notas:array[1..30,1..4] of real;
 
 
procedure entranom(tot:integer);
	var
		op:char;
		con:integer;
 
					begin
					op:='	';
					con:=1;
						repeat
							gotoxy(con,1);
							op:=upcase(readkey);
							case op of
								'A'..'Z':begin
												if (con<=tot) then begin
														gotoxy(11+con,1);write(op);
														insert(op,cadnom,con);
														inc(con);
														inc(tot);
												end;
											end;
								#8:begin
												if con>1 then begin
													tot:=tot+1;
													delete(cadnom,tot,con);
													dec(con);
													gotoxy(8+con,1);write(CHR(176));
												end;
										end;
							end;
							until(con>tot)or(op=#13);
							end;
 
 
procedure entrada;
	var
			op1:char;
					begin
					clrscr;
					write('Dar Nom_Ape S :');op1:=upcase(readkey);
						while (op1='S')and(i<30) do begin
					                clrscr;
					                cadnom:='	';
					                write('Da nombre:');
					                entranom(20);
					                Nom[i]:=cadnom;
					                cadnom:='	';
					                write('Da Apellido:');
					                entranom(40);
					                Ape[i]:=cadnom;
					                cadnom:='	';
 
					     end;
					end;
 
 
 
 
procedure lista;
 
					begin
 
 
					end;
 
procedure menu;
	var
	opcion,opcid:char;
	i1,z:integer;
	begin
		clrscr;
		for i1:=1 to 3 do begin
						 gotoxy(29,5+2*i1);
						 write(a[i1]);
						 end;
			OPCION:=' ';
		WHILE OPCION<>'S'DO BEGIN
				IF OPCI<1 THEN OPCI:=3;
				IF OPCI>3 THEN OPCI:=1;
							 gotoxy(29,5+2*opci);
							 textcolor(0);textbackground(7);
							 write(a[opci]);
							 textcolor(7);textbackground(0);
							 opcid:=READKEY;
							 z:=opci;
                CASE OPCID OF
                      #80:OPCI:=OPCI+1;
                      #72:OPCI:=OPCI-1;
                      #49:OPCI:=1;
                      #50:OPCI:=2;
                      #51:OPCI:=3;
                      #13:OPCION:='S';
                      END;
                      gotoxy(29,5+2*z);
                      write(a[z]);
             END;
end;
 
begin {programa_principal}
i:=1;
	repeat
		clrscr;
		menu;
			case opci of
				1:entrada;
				2:lista;
			end;
		until opci=3;
end.

el problema que tengo esque de la entrada no salgo
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 ejercicio final pascal

Publicado por ramon (2158 intervenciones) el 23/01/2016 12:05:08
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
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
{Mira esto}
 
 program arrayscadenas;
  uses
    crt;
  const
     elmenu : array[1..7] of string[8] = (
     'Entrad','Listado','Busqueda','Bajas','Ordena','Modifica','Finaliza');
 
     max = 30;
 
  var
    nombres : array[1..max] of string[30];
    apellidos : array[1..max] of string[40];
    notas : array[1..max,1..4] of real;
    erro, k, l, t, colo, m, p, cont : integer;
    temen, tecla : char;
    su : real;
    enc, final, mas : boolean;
    bus, nom : string[40];
    dd, ss, ornom : string[30];
    orape : string[40];
    nume : string[16];
    tor, orn1, orn2, orn3, orn4 : real;
 
   function entradatexto(cu : integer) : string;
   begin
      if cu = 1 then
      l := 30;
      if cu = 2 then
      l := 40;
      k := 1;
    repeat
       tecla := readkey;
       if (k <= l) and (tecla <> #13) then
       begin
       ornom[k] := tecla;
       ornom[0] := chr(k);
       k := k + 1;
       if k > l then
       begin
         writeln('  Fin De Entrada Pulse Enter');
         repeat
         tecla := readkey;
         until tecla = #13;
       end;
     end;
       if tecla = #8 then
       begin
          k := k - 1;
          if k < 1 then
          k := 1;
          ornom[k] := ' ';
          ornom[0] := chr(k);
       end;
    gotoxy(31,4);clreol;
    gotoxy(31,4);write(ornom);
    until tecla = #13;
    entradatexto := copy(ornom,1,length(ornom));
   end;
 
   function numerosreales : real;
   begin
      numerosreales := 0.0;
      k := 1;
     repeat
         tecla := readkey;
         if tecla in['1'..'9','0','.'] then
         begin
            nume[k] := tecla;
            nume[0] := chr(k);
            k := k + 1;
            if k > 16 then
            begin
              writeln('  Fin De Entrada Pulse Enter');
              repeat
                 tecla := readkey;
              until tecla = #13;
            end;
         end;
         if tecla = #8 then
         begin
            k := k - 1;
            if k < 1 then
            k := 1;
            nume[k] := ' ';
            nume[0] := chr(k);
         end;
         gotoxy(29,4);clreol;
         gotoxy(29,4);write(nume);
     until tecla = #13;
     val(nume,tor,erro);
     if erro <> 0 then
     begin
       repeat
        delete(nume,erro,1);
        val(nume,tor,erro);
       until erro = 0;
     end;
      numerosreales := tor;
   end;
 
   procedure entradadatos(i : integer);
   begin
      clrscr;
      writeln('   Entrada De Datos');
      writeln;
      gotoxy(10,4);clreol;
      gotoxy(10,4);write('   Entre Nombre    : ');
      nombres[i] := copy(entradatexto(1),1,30);
      gotoxy(10,4);clreol;
      gotoxy(10,4);write('   Entre Apellidos : ');
      apellidos[i] := copy(entradatexto(2),1,40);
      su := 0.0;
      for p := 1 to 3 do
      begin
      gotoxy(10,4);clreol;
      gotoxy(10,4);write('   Entre Nota ',p,' : ');
      notas[i][p] := numerosreales;
      su := su + notas[i][p];
      end;
      notas[i][p + 1] := su / 3;
   end;
 
 
   procedure inicio;
   begin
      clrscr;
     repeat
       entradadatos(cont);
       writeln;
       writeln('   Desea Mas Entradas [S/N]');
       repeat
           tecla := upcase(readkey);
       until tecla in['S','N'];
     if tecla = 'N' then
     mas := false
  else
     begin
     mas := true;
     cont := cont + 1;
     if cont > max then
     begin
        writeln;
        writeln('    Final De Entradas Pulse Una Tecla');
        readkey;
        mas := false;
     end;
   end;
     until mas = false;
   end;
 
   procedure listaentradas;
   begin
      clrscr;
      writeln('  Listado Datos');
      writeln;
      for colo := 1 to cont do
      begin
      writeln('  ',nombres[colo],'   ',apellidos[colo],'   ',notas[colo][1]:0:2,'   ',
      notas[colo][2]:0:2,'   ',notas[colo][3]:0:2,'   ',notas[colo][4]:0:2);
      end;
      writeln;
      writeln('   Pulse Una Tecla');
      readkey;
   end;
 
   procedure busqueda;
   begin
      clrscr;
      enc := false;
      writeln('  Busqueda ');
      writeln;
      write('   Entre Apellidos : ');
      readln(nom);
      for colo := 1 to length(nom) do
      nom[colo] := upcase(nom[colo]);
      for t := 1 to cont do
      begin
         bus := apellidos[t];
         for colo := 1 to length(bus) do
         bus[colo] := upcase(bus[colo]);
         if bus = nom then
         begin
      clrscr;
      writeln('  Busqueda ');
      writeln;
      writeln('  ',nombres[t],'   ',apellidos[t],'   ',notas[t][1]:0:2,'   ',
      notas[t][2]:0:2,'   ',notas[t][3]:0:2,'   ',notas[t][4]:0:2);
      writeln;
      writeln('   Pulse Una Tecla');
      readkey;
      enc := true;
      break;
         end;
      end;
      if enc = false then
      begin
        writeln;
        writeln('   Apellidos No Encontrados Pulse Una Tecla');
        readkey;
      end;
   end;
 
   procedure bajas;
   begin
      clrscr;
      enc := false;
      writeln('  Busqueda ');
      writeln;
      write('   Entre Apellidos : ');
      readln(nom);
      for colo := 1 to length(nom) do
      nom[colo] := upcase(nom[colo]);
      for t := 1 to cont do
      begin
         bus := apellidos[t];
         for colo := 1 to length(bus) do
         bus[colo] := upcase(bus[colo]);
         if bus = nom then
         begin
          writeln;
          writeln('   Desea Dar De Baja Este Dato [S/N]');
          repeat
             tecla := upcase(readkey);
          until tecla in['S','N'];
         if tecla = 'S' then
         begin
             nombres[t] := ' ';
             apellidos[t] := ' ';
             notas[t][1] := 0.0;
             notas[t][2] := 0.0;
             notas[t][3] := 0.0;
             notas[t][4] := 0.0;
             for colo := t + 1 to cont do
             begin
                nombres[t - 1] := nombres[t];
                apellidos[t - 1] := apellidos[t];
                notas[t - 1][1] := notas[t][1];
                notas[t - 1][2] := notas[t][2];
                notas[t - 1][3] := notas[t][3];
                notas[t - 1][4] := notas[t][4];
             end;
             cont := cont - 1;
             if cont < 1 then
             cont := 1;
         enc := true;
         break;
         end;
       end;
     end;
      if enc = false then
      begin
        writeln;
        writeln('   Apellidos No Encontrados Pulse Una Tecla');
        readkey;
      end;
    end;
 
    procedure ordena;
    begin
       clrscr;
       writeln('  Ordenando Por Nombre');
       writeln;
       for colo := 1 to cont do
         for t := cont downto colo + 1 do
         begin
           ss := nombres[colo];
           for l := 1 to length(ss) do
           ss[l] := upcase(ss[l]);
           dd := nombres[t];
           for k := 1 to length(dd) do
           dd[k] := upcase(dd[k]);
           if ss > dd then
           begin
              ornom := nombres[colo];
              orape := apellidos[colo];
              orn1 := notas[colo][1];
              orn2 := notas[colo][2];
              orn3 := notas[colo][3];
              orn4 := notas[colo][4];
              nombres[colo] := nombres[t];
              apellidos[colo] := apellidos[t];
              notas[colo][1] := notas[t][1];
              notas[colo][2] := notas[t][2];
              notas[colo][3] := notas[t][3];
              notas[colo][4] := notas[t][4];
              nombres[t] := ornom;
              apellidos[t] := orape;
              notas[t][1] := orn1;
              notas[t][2] := orn2;
              notas[t][3] := orn3;
              notas[t][4] := orn4;
           end;
         end;
         delay(1000);
    end;
 
    procedure modifica;
    begin
      clrscr;
      enc := false;
      writeln('  Modificacion ');
      writeln;
      write('   Entre Apellidos : ');
      readln(nom);
      for colo := 1 to length(nom) do
      nom[colo] := upcase(nom[colo]);
      for t := 1 to cont do
      begin
         bus := apellidos[t];
         for colo := 1 to length(bus) do
         bus[colo] := upcase(bus[colo]);
         if bus = nom then
         begin
            enc := true;
            break;
         end;
      end;
        if enc = true then
        begin
           clrscr;
           writeln('  Modificacion ');
           writeln;
           writeln(' [1] ',nombres[t],' [2] ',apellidos[t],' [3] ',
           notas[t][1]:0:2,' [4] ',notas[t][2]:0:2,' [5] ',notas[t][3]:0:2,
           '  [6] Nada');
           writeln;
           writeln('   Que Dato Desea Modificar Entre Numero ');
           writeln;
           write('   Num. : ');
         repeat
           tecla := readkey;
         until tecla in['1','2','3','4','5','6'];
         clrscr;
     if tecla < '6' then
     begin
     case tecla of
  '1' : begin
          write('  Nombre : ');
          readln(nombres[t]);
        end;
  '2' : begin
          write('   Apellidos');
          readln(apellidos[t]);
        end;
  '3' : begin
          write('  Nota Num. 1 : ');
          readln(notas[t][1]);
        end;
  '4' : begin
          write('  Nota Num. 2 : ');
          readln(notas[t][2]);
        end;
  '5' : begin
          write('  Nota Num. 3 : ');
          readln(notas[t][3]);
        end;
      end;
        notas[t][4] := (notas[t][1] + notas[t][2] + notas[t][3]) / 3;
     end;
        end
      else
         begin
          writeln;
          writeln('   Apellidos No Encontrados Pulse Una Tecla');
          readkey;
         end;
    end;
 
 
 
   procedure presentamenu(cc : integer);
   begin
       clrscr;
       textcolor(7);
       gotoxy(10,2);write('    ***** Menu Jeneral *****');
       for colo := 1 to 7 do
       begin
          gotoxy(10,2 + colo);write(elmenu[colo]);
       end;
       case cc of
    1 : begin
         textcolor(11);
         gotoxy(10,2 + 1);write(elmenu[1]);
        end;
    2 : begin
         textcolor(11);
         gotoxy(10,2 + 2);write(elmenu[2]);
        end;
    3 : begin
         textcolor(11);
         gotoxy(10,2 + 3);write(elmenu[3]);
        end;
    4 : begin
         textcolor(11);
         gotoxy(10,2 + 4);write(elmenu[4]);
        end;
    5 : begin
         textcolor(11);
         gotoxy(10,2 + 5);write(elmenu[5]);
        end;
    6 : begin
         textcolor(11);
         gotoxy(10,2 + 6);write(elmenu[6]);
        end;
    7 : begin
         textcolor(11);
         gotoxy(10,2 + 7);write(elmenu[7]);
        end;
       end;
       textcolor(7);
       gotoxy(10,2 + 9);write('  Elija Opcion Con [',chr(24),chr(25),
                                               '] Y Enter');
   end;
 
   procedure menu;
   begin
     final := false;
     m := 1;
     cont := 1;
    repeat
       presentamenu(m);
       temen := readkey;
       if temen = #27 then
       final := true;
       if temen = #72 then
       begin
         m := m - 1;
         if m < 1 then
         m := 1;
       end;
       if temen = #80 then
       begin
          m := m + 1;
          if m > 7 then
          m := 7;
       end;
    if temen = #13 then
    begin
       case m of
    1 : inicio;
    2 : listaentradas;
    3 : busqueda;
    4 : bajas;
    5 : ordena;
    6 : modifica;
    7 : final := true;
     end;
    end;
    until final = 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
0
Comentar