Pascal/Turbo Pascal - hacer un fichero con un numero limitado de estudiantes

 
Vista:
sin imagen de perfil

hacer un fichero con un numero limitado de estudiantes

Publicado por douglas (14 intervenciones) el 15/09/2015 02:06:04
hola deseo la ayuda de ustedes que son uno masters para esto

quiero hacer un fichero con un numero limitado de estudiantes 100 usar un array
datos personales y las materias ,calificaciones
los menus deben ser

ingresar alumno
ingresar las materias, calificaciones
modificar datos
consultas datos generales
consultar alumnos aprobados y reprobados
salir

de antemano muchas gracias y exitos en sus labores
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

hacer un fichero con un numero limitado de estudiantes

Publicado por ramon (2158 intervenciones) el 16/09/2015 19:06:01
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
{Esto iría valiendo }
 
 program ficheros;
  uses
     crt;
  const
     max = 100;
   type
     estudia = record
            niden : longint;
           nombre : string[30];
      priapellido : string[30];
     seguapellid  : string[30];
         materias : array[1..6] of string[50];
         numateri : integer;
         califica : array[1..6] of real;
        end;
 
 
    var
     estudiante : array[1..max] of estudia;
     tecla : char;
     salir : boolean;
     cont : integer;
 
 
   procedure entradadatos(n : integer);
   var
     m : integer;
     sal : boolean;
     tec : char;
   begin
      if n < max  then
      begin
         clrscr;
         fillchar(estudiante[n].califica,sizeof(estudiante[n].califica),' ');
         write('   Entre Nø Matricula : ');
         readln(estudiante[n].niden);
         write('   Entre Nombre       : ');
         readln(estudiante[n].nombre);
         write('   Entre 1ø Apellido  : ');
         readln(estudiante[n].priapellido);
         write('   Entre 2ø Apellido  : ');
         readln(estudiante[n].seguapellid);
         m := 1;
         sal := false;
       repeat
         write('   Entre Materia Nø ',m,' : ');
         readln(estudiante[n].materias[m]);
         writeln('    Desea Entrar Mas Materias [S/N]');
         repeat
             tec := upcase(readkey);
         until tec in['S','N'];
      if tec = 'S' then
      m := m + 1
    else
       sal := true;
       until (m > 6) or (sal = true);
       if m > 6 then
       estudiante[n].numateri := 6
    else
       estudiante[n].numateri := m;
       fillchar(estudiante[n].califica,sizeof(estudiante[n].califica),' ');
       writeln;
       writeln('   Datos Correctos [S/N]');
       repeat
         tec := upcase(readkey);
       until tec in['S','N'];
       if tec = 'S' then
       cont := cont + 1
    else
       fillchar(estudiante[n],sizeof(estudiante[n]),' ');
      end
   else
      begin
        writeln('   Array Terminado Pulse Una Tecla');
        readkey;
      end;
  end;
 
  procedure Ingresar_Calificacion;
  var
    mm : longint;
    w, mn, d : integer;
    enco : boolean;
  begin
      clrscr;
      enco := false;
      writeln;
      writeln('  Entrada Valores Calificacion ');
      writeln;
      write('   Entre Nø Matricula : ');
      readln(mm);
      for d := 1 to cont do
      begin
      if estudiante[d].niden = mm then
      begin
         enco := true;
         mn := d;
         break;
      end;
     end;
     if enco = true then
     begin
        clrscr;
        writeln;
        for w := 1 to estudiante[mn].numateri  do
        begin
        writeln('   Entre Valor Calificacion Para ',
        estudiante[mn].materias[w],' : ');
        readln(estudiante[mn].califica[w]);
        end;
     end
  else
     begin
        writeln('   Numero Matricula No Encontrada Pulse Una Tecla');
        readkey;
     end;
  end;
 
 
  procedure Consultas_Datos;
  var
   mm : longint;
   enco : boolean;
   t, nm, p : integer;
  begin
      clrscr;
      enco := false;
      writeln;
      writeln('  Consulta Dato Alumno ');
      writeln;
      write('   Entre Nø Matricula : ');
      readln(mm);
      for t := 1 to cont do
      begin
      if estudiante[t].niden = mm then
      begin
         enco := true;
         nm := t;
         break;
      end;
    end;
      if enco = true then
       begin
        clrscr;
        writeln;
        with estudiante[nm] do
        begin
       write('  ',niden,'  ',nombre ,'  ',priapellido,'  ',seguapellid);
       writeln;
       for p := 1 to numateri do
       write('  ',materias[p],'  ');
       writeln;
        for p := 1 to numateri do
        write('  ',califica[p]:0:2,'  ');
       end;
       writeln;
       writeln('   Pulse Una Tecla');
       readkey;
     end
    else
      begin
         writeln('   Numero Matricula No Encontrada Pulse Una Tecla');
         readkey;
      end;
  end;
 
 
 
   procedure menu;
   var
     te : char;
     fin : boolean;
   begin
      fin := false;
    repeat
      clrscr;
      writeln;
      writeln('   ****  Menu Jeneral ****');
      writeln;
      writeln('   1 = Ingresar Alumno');
      writeln('   2 = Ingresar Calificacion');
      writeln('   3 = Modificar Datos');
      writeln('   4 = Consultas Datos');
      writeln('   5 = Consultar Alumnos Aprobados y Reprobados');
      writeln('   6 = salir');
      writeln;
      writeln('   >>> Elija Opcion <<<');
      repeat
         te := readkey;
      until te in['1','2','3','4','5','6'];
      clrscr;
    case te of
  '1' : entradadatos(cont);
  '2' : Ingresar_Calificacion;
  '3' :;
  '4' : Consultas_Datos;
  '5' :;
  '6' : fin := true;
    end;
    until fin = true;
   end;
 
 
 
   begin
      cont := 1;
      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
sin imagen de perfil

hacer un fichero con un numero limitado de estudiantes

Publicado por Douglas (14 intervenciones) el 16/09/2015 19:29:43
Muchas gracias por responder lo voy a probar
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

hacer un fichero con un numero limitado de estudiantes

Publicado por ramon (2158 intervenciones) el 16/09/2015 21:08:04
Como apreciaras no esta terminado pero si la estructura del registro vale te terminare el ejemplo.
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
sin imagen de perfil

hacer un fichero con un numero limitado de estudiantes

Publicado por Douglas (14 intervenciones) el 17/09/2015 02:14:14
muchas gracias ya lo probé es mas de lo que yo esparaba agradezco el tiempo que te tomaste para escribirlo
si puedes agregar el menu de modificar los datos que se ingresan
y el menu de consultar alumnos aprobados y reprobados hacer dos consultas

una general un listado de los alumnos si me puedes ayudar con hacer funcionar las flechas del teclado para avanzar de linea en linea con tabulador avanzar a otras listas y con backspace regresar a la lista anterior ( yo no se hacer funcionar esas teclas en programación)

la otra consulta individual con el numero de la matricula del alumno

desde ya estoy eternamente agradecido gracias por compartir tus conocimientos por responder voy a revisar los demás códigos que ha hecho porque hay mucho que aprender de usted y de este foro

le deseo muchos éxitos en sus labores y bendiciones sobre abundantes saludos cordiales desde Guatemala

espero su respuesta
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

hacer un fichero con un numero limitado de estudiantes

Publicado por ramon (2158 intervenciones) el 17/09/2015 21:44:27
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
{Esto es el programa lo del teclado te pasare un ejemplo}
 
 program ficheros;
  uses
     crt;
  const
     max = 100;
   type
     estudia = record
            niden : longint;
           nombre : string[30];
      priapellido : string[30];
     seguapellid  : string[30];
         materias : array[1..6] of string[50];
         numateri : integer;
         califica : array[1..6] of real;
        end;
 
 
    var
     estudiante : array[1..max] of estudia;
     tecla : char;
     salir : boolean;
     cont : integer;
 
 
   procedure entradadatos(n : integer);
   var
     m : integer;
     sal : boolean;
     tec : char;
   begin
      if n < max  then
      begin
         clrscr;
         fillchar(estudiante[n].califica,sizeof(estudiante[n].califica),' ');
         write('   Entre Nø Matricula : ');
         readln(estudiante[n].niden);
         write('   Entre Nombre       : ');
         readln(estudiante[n].nombre);
         write('   Entre 1ø Apellido  : ');
         readln(estudiante[n].priapellido);
         write('   Entre 2ø Apellido  : ');
         readln(estudiante[n].seguapellid);
         m := 1;
         sal := false;
       repeat
         write('   Entre Materia Nø ',m,' : ');
         readln(estudiante[n].materias[m]);
         writeln('    Desea Entrar Mas Materias [S/N]');
         repeat
             tec := upcase(readkey);
         until tec in['S','N'];
      if tec = 'S' then
      m := m + 1
    else
       sal := true;
       until (m > 6) or (sal = true);
       if m > 6 then
       estudiante[n].numateri := 6
    else
       estudiante[n].numateri := m;
       fillchar(estudiante[n].califica,sizeof(estudiante[n].califica),' ');
       writeln;
       writeln('   Datos Correctos [S/N]');
       repeat
         tec := upcase(readkey);
       until tec in['S','N'];
       if tec = 'S' then
       cont := cont + 1
    else
       fillchar(estudiante[n],sizeof(estudiante[n]),' ');
      end
   else
      begin
        writeln('   Array Terminado Pulse Una Tecla');
        readkey;
      end;
  end;
 
  procedure Ingresar_Calificacion;
  var
    mm : longint;
    w, mn, d : integer;
    enco : boolean;
  begin
      clrscr;
      enco := false;
      writeln;
      writeln('  Entrada Valores Calificacion ');
      writeln;
      write('   Entre Nø Matricula : ');
      readln(mm);
      for d := 1 to cont do
      begin
      if estudiante[d].niden = mm then
      begin
         enco := true;
         mn := d;
         break;
      end;
     end;
     if enco = true then
     begin
        clrscr;
        writeln;
        for w := 1 to estudiante[mn].numateri  do
        begin
        write('   Entre Valor Calificacion Para ',
        estudiante[mn].materias[w],' : ');
        {$I-} readln(estudiante[mn].califica[w]); {$I+}
        if ioresult <> 0 then
        begin
          writeln('Error De Entrada Entrela De Nuevo');
          write('   Entre Valor Calificacion Para ',
          estudiante[mn].materias[w],' : ');
          readln(estudiante[mn].califica[w]);
        end;
        end;
     end
  else
     begin
        writeln('   Numero Matricula No Encontrada Pulse Una Tecla');
        readkey;
     end;
  end;
 
  procedure Consultas_Datos;
  var
   mm : longint;
   enco : boolean;
   t, nm, p : integer;
  begin
      clrscr;
      enco := false;
      writeln;
      writeln('  Consulta Dato Alumno ');
      writeln;
      write('   Entre Nø Matricula : ');
      readln(mm);
      for t := 1 to cont do
      begin
      if estudiante[t].niden = mm then
      begin
         enco := true;
         nm := t;
         break;
      end;
    end;
      if enco = true then
       begin
        clrscr;
        writeln;
        with estudiante[nm] do
        begin
       write(' ',niden,'  ',nombre ,'  ',priapellido,'  ',seguapellid);
       writeln;
       for p := 1 to numateri do
       write(' ',materias[p],' ');
       writeln;
        for p := 1 to numateri do
        write('   ',califica[p]:0:2,'  ');
       end;
       writeln;
       writeln('   Pulse Una Tecla');
       readkey;
     end
    else
      begin
         writeln('   Numero Matricula No Encontrada Pulse Una Tecla');
         readkey;
      end;
  end;
 
  procedure consultar_aprovados;
  const
     aprovado = 6;
  var
    d, t : integer;
   begin
      for t := 1 to cont do
      begin
         with estudiante[t] do
         begin
            if niden <> 0 then
            begin
            writeln('   Matricula = ',niden);
            writeln;
            for d := 1 to numateri do
            if niden <> 0 then
            if califica[d] >= aprovado then
            write('  ',materias[d],' = Aprovado')
          else
            write('  ',materias[d],' = Suspendido')
         end;
      end;
    end;
   end;
 
 
  procedure Modificar_Datos;
  var
   mm : longint;
   final, enco, sa : boolean;
   t, nm, p : integer;
   tt, tre : char;
   begin
      clrscr;
      enco := false;
      writeln;
      writeln('  Modificar Datos Alumno ');
      writeln;
      write('   Entre Nø Matricula : ');
      readln(mm);
      for t := 1 to cont do
      begin
      if estudiante[t].niden = mm then
      begin
         enco := true;
         nm := t;
         break;
      end;
    end;
      if enco = true then
       begin
        clrscr;
        writeln;
        writeln(' *** Modificar zona ***  ');
        writeln('   1 = Nombre  2 = primer apellido  3 = segundo apellido');
        writeln('   4 = Materia 5 = calificacion  6 = Salir');
        final := false;
        with estudiante[nm] do
        begin
        repeat
           tre := readkey;
    case tre of
  '1' : begin
          write('   Modifica Nombre       : ');
          readln(nombre);
        end;
  '2' : begin
          write('   Modifica 1ø Apellido  : ');
          readln(priapellido);
       end;
  '3' : begin
         write('    Modifica 2ø Apellido  : ');
         readln(seguapellid);
       end;
  '4' : begin
          writeln(' *** Modificar Materia ***  ');
          for t := 1 to numateri do
          write('  ',t,'  ',materias[t]);
          write('  7  Salir');
          sa := false;
          repeat
          tt := readkey;
         if tt <> '7' then
          if ord(tt) - 48 > numateri then
          tt := chr(ord(numateri) + 48);
       case tt of
    '1' : begin
             write('Materia Actual [',materias[1],'] Nueva : ');
             readln(materias[1]);
          end;
    '2' : begin
            write('Materia Actual [',materias[2],'] Nueva : ');
             readln(materias[2]);
          end;
    '3' : begin
             write('Materia Actual [',materias[3],'] Nueva : ');
             readln(materias[3]);
          end;
    '4' : begin
            write('Materia Actual [',materias[4],'] Nueva : ');
             readln(materias[4]);
          end;
    '5' : begin
            write('Materia Actual [',materias[5],'] Nueva : ');
             readln(materias[5]);
          end;
    '6' : begin
            write('Materia Actual [',materias[6],'] Nueva : ');
             readln(materias[6]);
          end;
    '7' : sa := true;
       end;
          until sa = true;
          clrscr;
          writeln;
          writeln(' *** Modificar zona ***  ');
          writeln('   1 = Nombre  2 = primer apellido  3 = segundo apellido');
          writeln('   4 = Materia 5 = calificacion  6 = Salir');
       end;
  '5' : begin
         writeln(' *** Modificar Calificacion ***  ');
          for t := 1 to numateri do
          write('  ',t,'  ',califica[t]);
          write('  7  Salir');
          sa := false;
          repeat
          tt := readkey;
         if tt <> '7' then
          if ord(tt) - 48 > numateri then
          tt := chr(ord(numateri) + 48);
       case tt of
    '1' : begin
             write('Calificacion Actual [',califica[1]:0:2,'] Nueva : ');
             readln(califica[1]);
          end;
    '2' : begin
            write('Calificacion Actual [',califica[2]:0:2,'] Nueva : ');
             readln(califica[2]);
          end;
    '3' : begin
             write('Calificacion Actual [',califica[3]:0:2,'] Nueva : ');
             readln(califica[3]);
          end;
    '4' : begin
            write('Calificacion Actual [',califica[4]:0:2,'] Nueva : ');
             readln(califica[4]);
          end;
    '5' : begin
            write('Calificacion Actual [',califica[5]:0:2,'] Nueva : ');
             readln(califica[5]);
          end;
    '6' : begin
            write('Calificacion Actual [',califica[6]:0:2,'] Nueva : ');
             readln(califica[6]);
          end;
    '7' : sa := true;
       end;
          until sa = true;
          clrscr;
          writeln;
          writeln(' *** Modificar zona ***  ');
          writeln('   1 = Nombre  2 = primer apellido  3 = segundo apellido');
          writeln('   4 = Materia 5 = calificacion  6 = Salir');
       end;
  '6' : final := true;
   end;
     until final = true;
     end;
   end;
  end;
 
 
 
   procedure menu;
   var
     te : char;
     fin : boolean;
   begin
      fin := false;
    repeat
      clrscr;
      writeln;
      writeln('   ****  Menu Jeneral ****');
      writeln;
      writeln('   1 = Ingresar Alumno');
      writeln('   2 = Ingresar Calificacion');
      writeln('   3 = Modificar Datos');
      writeln('   4 = Consultas Datos');
      writeln('   5 = Consultar Alumnos Aprobados y Reprobados');
      writeln('   6 = salir');
      writeln;
      writeln('   >>> Elija Opcion <<<');
      repeat
         te := readkey;
      until te in['1','2','3','4','5','6'];
      clrscr;
    case te of
  '1' : entradadatos(cont);
  '2' : Ingresar_Calificacion;
  '3' : Modificar_Datos;
  '4' : Consultas_Datos;
  '5' : begin
          consultar_aprovados;
           writeln;
           writeln('  Pulse Una Tecla');
           readkey;
        end;
  '6' : fin := true;
    end;
    until fin = true;
   end;
 
 
 
   begin
      cont := 1;
      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
sin imagen de perfil

hacer un fichero con un numero limitado de estudiantes

Publicado por Douglas (14 intervenciones) el 18/09/2015 06:13:30
muchas gracias estaré pendiente
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

hacer un fichero con un numero limitado de estudiantes

Publicado por ramon (2158 intervenciones) el 21/09/2015 19:29:18
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
{Mira a si se manejan las teclas acopla lo  como desees }
 
program funciondeteclas;
 uses
    crt;
  const
     texto = 'Paseando';
  type
    string8 = string[8];
 
  var
    tecla : char;
    antx, anty, x, y : integer;
 
   procedure presenta_texto(x1, y1 : integer;tex : string8);
   begin
      gotoxy(antx,anty);write('        ');
      gotoxy(x1,y1);write(tex);
      antx := x1;
      anty := y1;
   end;
 
 
   begin
       clrscr;
       antx := 0;
       anty := 0;
       x := 10;
       y := 2;
       gotoxy(12,24);write('Usar Teclas Flechas/tabulador/backspace/asc');
       presenta_texto(x,y,texto);
    repeat
        tecla := readkey;
        if tecla = #0 then
        tecla := readkey;
    case tecla of
 #72 : begin   {desplazamiento arriva}
          y := y - 1;
         if y < 1 then
         y := 1;
       end;
 #80 : begin {desplazamiento avajo}
          y := y + 1;
         if y > 23 then
         y := 23;
       end;
 #75 : begin {desplazamiento derecha}
         x := x - 1;
          if x < 1 then
          x := 1;
       end;
 #77 : begin {desplazamiento izquierda}
         x := x + 1;
          if x > 79 then
          x := 79;
       end;
 #8  : begin {desplazamiento todo abajo}
         if y < 23 then
         y := 23;
      end;
 #9  : begin {desplazamiento todo arriva}
          if y > 1 then
          y := 1;
       end;
    end;
       presenta_texto(x,y,texto);
    until tecla = #27;
   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

hacer un fichero con un numero limitado de estudiantes

Publicado por Douglas (14 intervenciones) el 22/09/2015 03:09:08
muchas gracias
funciona calidad te agradezco bastante amigo gracias por compartir
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