Pascal/Turbo Pascal - lo necesito si no reprobare D:

 
Vista:
sin imagen de perfil

lo necesito si no reprobare D:

Publicado por bob (8 intervenciones) el 19/02/2014 01:09:57
necesito crear una boleta en pascal mas o menos haci es el cuerpo del programa ayudenme a completarlo tiene que hacer mas o menos al correrlo como un menu donde ingreses datos, que encuentre el curp,etc.
program laescuela; uses crt; type materias= (esp,mat,his,cie,fce,art,tec,ori,dep); datos = record escuela:string; cveCentroT:string; nombre:string; apePatA:string; apeMatA:string; curp:string; grupo:string; turno:string; end; calificacion = record asignatura:materias; periodo:integer; inasistencias:integer; grado:integer; curp:string; end; alumnos=Array [1..100] of datos; boletas=array [1..10] of calificacion; procedure capturalumno (var a:alumnos; var total:integer); var curp:string; curp1:string; i:integer; band:boolean; op:char; totalu:integer; begin repeat clrscr; if total=0 then begin totalu:=totalu+1; write ('curp:');readln (a[totalu].curp); write ('nombre');readln (a[totalu].nombre); write ('escuela');readln (a[totalu].escuela); write ('cveCentroT');readln (a[totalu].cveCentroT); write ('apePatA');readln (a[totalu].apePatA); write ('apeMatA');readln (a[totalu].apeMatA); write ('grupo');readln (a[totalu].grupo); write ('turno');readln (a[totalu].turno); if band:=false Then Totalu:=totalu+1; A [totalu].curp:=curp1; Write ('nombre:'), readln (a[total].nombre); Else Writeln('el alumno ya existe'); Write ('desea ingresar otro alumno [s/n]; readln (o)'); Until (op='N') or (op='n'); End; Procedure listar_alumnos (a:alumnos; totalu:integer); Var I:integer; Begin For i:=1 to totalu do Writeln (a[i].curp,' ',a[i].nombre,' ', a[i].ap pat,' ', a[i].ap mat,' ', a[i].escuela, ' ', a[i].cveCentroT, ' ', a[i].grupo, ' ', a[i].turno, ' ',); Readln; End; Procedure leercalif (a:alumno; totalu:integer; var b:boletas;var totbol:integer); Var Band:Boolean; Mater:materias; X,i:integer Curp1:string; Op:integer; Begin If totalu=0 then Begin Write ('no hay alumnos escritos press any key to continue'); Readln; End Else Begin Write ('curp'); readln (curp1); Band:= false; For i:= to totalu do If a[i]. curp =curp1 Then Begin Band:=true; X:=i; End; If band:= true Then Totalu:=totalu+1 B [totalu].curp1; For i:= 1 to totalbol do If (b[i].curp=curp1) and (b[i].asignatura=mater) Band=true If band=true then Write ('ya registraste esta materia.. press..'); Write ('quieres ingresas otra asignatura [s/n:'); Readln (op1) Until (op1='N') or (op1 = 'n') End;
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

lo necesito si no reprobare D:

Publicado por ramon (2158 intervenciones) el 24/02/2014 10:51: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
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
{Mira tu estructura de array y registros es demasiado grande para pascal pues este no permite mas de 65k y tu en el array
pones 100 si lo multiplicas 256 * 8 datos que tienes en el registro te dará 2048 bytes por 100 del array tienes 204800 bytes
o sea 204k lo que causa un error en pascal aparte de eso repites demasiadas variables lo cual agranda el problema de
memoria mira esto que te paso y ajustarlo a tus necesidades}
 
program laescuela;
 {$M 16384, 0, 65535}
 uses
    crt;
 type
   string50 = string[50];
   materias = (esp,mat,his,cie,fce,art,tec,ori,dep);
   datos = record
      escuela : string[80];
   cveCentroT : string[80];
       nombre : string[50];
      apePatA : string[50];
      apeMatA : string[50];
         iden : word;
         curp : string[10];
        grupo : string[10];
        turno : string[5];
      end;
 
     calificacion = record
          asignatura : materias;
             periodo : integer;
       inasistencias : integer;
               grado : integer;
                curp : string[10];
              end;
 
 
 
   var
     alumnos : Array [1..100] of datos;
     boletas : array [1..10] of calificacion;
         tot : integer;
          te : char;
       Mater : materias;
 
  function esiste(n, p1, p2 : string50; var j : word) : boolean;
  var
    h, v1p, v2p, v3p, i : integer;
    re, id : word;
  begin
     esiste := false;
     v1p := 0;
     for i := 1 to length(n) do
     v1p := v1p + ord(upcase(n[i]));
     v2p := 0;
     for i := 1 to length(P1) do
     v2p := v2p + ord(upcase(P1[i]));
     v3p := 0;
     for i := 1 to length(p2) do
     v3p := v3p + ord(upcase(p2[i]));
     id := (v1p + v2p + v3p);
     for h := 1 to tot do
     begin
        if alumnos[h].iden = id then
        begin
          esiste := true;
          break;
        end;
     end;
     j := id;
  end;
 
  procedure datos_alumnos(var alumn : datos);
  begin
     with alumn do
     begin
     write('  Entre Nombre      : ');
     readln(nombre);
     write('  Entre 1. Apellido : ');
     readln(apePatA);
     write('  Entre 2. Apellido : ');
     readln(apeMatA);
     if esiste(nombre, apePatA, apeMatA, iden) = true then
     begin
       writeln('  El Alumno ya Existe Pulse Una Tecla');
       readkey;
     end
   else
      begin
         write('  Escuela       : ');
         readln(escuela);
         write('  CveCentroT    : ');
         readln(cveCentroT);
         write('  Curp          : ');
         readln(curp);
         write('  Grupo         : ');
         readln(grupo);
         write('  Turno         : ');
         readln(turno);
      end;
    end;
  end;
 
  procedure presenta_alumnos;
  var
   p : integer;
  begin
     p := 1;
     clrscr;
   repeat
      with alumnos[p] do
      begin
      writeln(escuela,'  ',cveCentroT,'  ',nombre,'  ',apePatA,'  ',apeMatA,
      '  ',curp,'  ',grupo,'  ',turno);
      end;
      p := p + 1;
   until p > tot;
   readkey;
  end;
 
  Procedure leercalif(totalu : integer);
  var
   totbol : integer;
    Band : Boolean;
    X, i : integer;
    Curp1 : string[10];
    Op : char;
  Begin
   If totalu = 0 then
   Begin
      Write ('no hay alumnos escritos press any key to continue');
      Readln;
    End
 Else
    Begin
    repeat
        Write('curp : ');
        readln(curp1);
        Band := false;
   For i := 1 to totalu do
   If alumnos[i].curp = curp1 Then
   Begin
      Band := true;
      X := i;
   End;
   If band = true Then
    Totalu := totalu + 1;
      For i := 1 to totalu do
      If (boletas[i].curp = curp1) and (boletas[i].asignatura = mater) then
      Band := true;
       If band = true then
       Write('ya registraste esta materia.. press..');
      Write('quieres ingresas otra asignatura [s/n:');
      Readln(op);
   Until (op = 'N') or (op = 'n');
  End;
 end;
 
   begin
     clrscr;
     tot := 1;
    repeat
     datos_alumnos(alumnos[tot]);
     writeln;
     writeln('  Desea entrar mas datos S/N ');
     repeat
         te := upcase(readkey);
     until te in['S','N'];
     if te = 'S' then
     tot := tot + 1;
    until te = 'N';
    presenta_alumnos;
    leercalif(tot);
   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