Pascal/Turbo Pascal - ¿Qué estoy haciendo mal? ¿por qué me da error?

 
Vista:

¿Qué estoy haciendo mal? ¿por qué me da error?

Publicado por Fede (19 intervenciones) el 20/04/2012 16:13:41
Buenas, al probar este código me da error no sé porqué. Espero me puedan ayudar. Quizás después de este haya otros errores pero quiero saber porqué me da error en primera instancia. Solo eso.

Gracias de antemano.

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
program ej(input,output);
uses crt;
type
unalu=record
nya:string;
d:string;
t:integer;
dym:integer;
c:char;
z:integer;
end;
alumnos=file of unalu;
var
p,t:alumnos;
reg,reg1:unalu;
i,op,u:integer;
 
procedure diame(reg.dym:unalu);
begin
writeln('ingresar dia y mes');
readln(reg.dym);
end;
 
procedure zona(reg.z:unalu);
var c;
begin
c:=0;
writeln('tu zona es');
c:=c+1;
writeln(c);
end;
 
function fecha(reg.dym:unalu):boolean;
begin
writeln('cuanto es uno mas uno');
readln(u);
if (u=2)
         then fecha:=true
         else fecha:=false ;
 
 end;
 
procedure carga;
begin
assign(p,'c:\pedidos.dat');
rewrite(p);
writeln('ingrese nombre y apellido');
readln(ny);
while (ny<>'*') do
begin
reg.nya:=ny;
writeln('ingrese direccion');
readln(reg.d);
writeln('ingrese telefono');
readln(reg.t);
diame(reg.dym);
repeat
writeln('ingrese cable');
readln(reg.c);
until (reg.c='c') or (reg.c='w');
zona(reg.z);
write(p,reg);
writeln('ingrese nombre y apellido');
readln(ny);
end;
close(p);
end;
 
 
procedure  confirm;
begin
assign(t,'c:\trabajos.dat');
assign(p,'c:\pedidos.dat');
rewrite(t);
reset(p);
read(p,reg);
while not(eof(p)) do
begin
if fecha(reg.dym) then begin
                       repeat
                       writeln('confirmacion, si o no');
                       readln(resp);
                       until (resp='s') or (resp='n');
 
if (resp='s')     then write(t,reg1);
 
end;
close(p);
close(t);
end;
 
procedure listado;
begin
assign(t,'c:\trabajos.dat');
reset(t);
for i:=1 to 10 do
begin
v[i]:=0;
end;
while not(eof(t)) do
begin
for i:=1 to 10 do
reg.c='w'
then v[i]:=v[i]+1;
end;
close (t);
end;
 
 
begin
repeat
clrscr;
writeln('1-carga');
writeln('2-confirmacion');
writeln('3-listado');
writeln('4-fin');
repeat
writeln('ingrese numero');
readln(op);
until (op>=1) and (op<=4);
case op of
1:carga;
2:confirm;
3:listado;
end;
until (op=4);
repeat until keypressed;
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

¿Qué estoy haciendo mal? ¿por qué me da error?

Publicado por ramon (2158 intervenciones) el 23/04/2012 22:44: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
{Funciona ya asta el menú compáralo y veras los errores}
 
 program ej(input,output);
uses crt;
type
unalu=record
nya:string;
d:string;
t:integer;
dym:integer;
c:char;
z:integer;
end;
alumnos=file of unalu;
var
p,t:alumnos;
reg,reg1:unalu;
i,op,u:integer;
 resp : char;
 v : array[1..10] of integer;
procedure diame(reg:unalu);
begin
writeln('ingresar dia y mes');
readln(reg.dym);
end;
 
procedure zona(reg:unalu);
var c :integer;
begin
c:=0;
writeln('tu zona es');
c:=c+1;
writeln(c);
end;
 
function fecha(reg:unalu):boolean;
begin
writeln('cuanto es uno mas uno');
readln(u);
if (u=2)
then fecha:=true
else fecha:=false ;
 
end;
 
procedure carga;
begin
assign(p,'c:\pedidos.dat');
rewrite(p);
writeln('ingrese nombre y apellido');
readln(reg.nya);
while (reg.nya<>'*') do
begin
writeln('ingrese direccion');
readln(reg.d);
writeln('ingrese telefono');
readln(reg.t);
diame(reg);
repeat
writeln('ingrese cable');
readln(reg.c);
until (reg.c='c') or (reg.c='w');
zona(reg);
write(p,reg);
writeln('ingrese nombre y apellido');
readln(reg.nya);
end;
close(p);
end;
 
 
procedure confirm;
begin
assign(t,'c:\trabajos.dat');
assign(p,'c:\pedidos.dat');
rewrite(t);
reset(p);
read(p,reg);
while not(eof(p)) do
begin
if fecha(reg) then begin
repeat
writeln('confirmacion, si o no');
readln(resp);
until (resp='s') or (resp='n');
 
if (resp='s') then write(t,reg1);
end;
end;
close(p);
close(t);
end;
 
procedure listado;
begin
assign(t,'c:\trabajos.dat');
reset(t);
for i:=1 to 10 do
begin
v[i]:=0;
end;
while not(eof(t)) do
begin
for i:=1 to 10 do
if reg.c='w' then
v[i]:=v[i]+1;
end;
close (t);
end;
 
 
begin
repeat
clrscr;
writeln('1-carga');
writeln('2-confirmacion');
writeln('3-listado');
writeln('4-fin');
repeat
writeln('ingrese numero');
readln(op);
until (op>=1) and (op<=4);
case op of
1:carga;
2:confirm;
3:listado;
end;
until (op=4);
repeat until keypressed;
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

¿Qué estoy haciendo mal? ¿por qué me da error?

Publicado por Fede (19 intervenciones) el 24/04/2012 16:50:51
Muchas 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