"ELSE" problema de syntax ¿Cómo lo resuelvo?¿Qué me falta?
Publicado por erick (3 intervenciones) el 15/07/2020 17:05:19
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
program lab2;
uses crt;
type
sec_numero = file of Integer;
sec_sal = file of Char;
var
sec: sec_numero;
salida:sec_sal;
v:Integer;
cont, i, y,bin : Integer;
Procedure InicializarSecuencia(VAR sec_local: sec_numero);
begin
assign(sec_local, 'datos_secuencia.txt');
//Control de acciones sobre el archivo
{$I-}
reset(sec_local);
{$I+}
//Verifico estado de la accion ejecutada
if IOResult <> 0 then
writeln('No se pudo crear el archivo...ERROR');
end;
Procedure CrearSecuenciaSalida(VAR sec_salida: sec_sal);
begin
assign(sec_salida, 'datos_salida.txt');
//Control de acciones sobre el archivo
{$I-}
rewrite(sec_salida);
{$I+}
//Verifico estado de la accion ejecutada
if IOResult <> 0 then
writeln('No se pudo crear el archivo...ERROR');
end;
begin
clrscr;
InicializarSecuencia(sec);
CrearSecuenciaSalida(salida);
cont:= 0;
i:= 0;
y:= 0;
writeln('**********************************************************************');
writeln('Este programa convierte los numeros en base binaria a base hexadecimal');
writeln('**********************************************************************');
readkey;
read(Sec,v);
while not eof(sec) do
begin
for i := 1 to 4 do
begin
if i = 1 then
begin
case v of
1: bin:= 8;
0: bin:= 0;
else
write('ERROR');
end;
Else // ACA SE PRESENTA EL ERROR
begin
if i = 2 then
begin
case v of
1:bin:= 4;
0:bin:= 0;
else
write('ERROR');
end;
end;
Else
begin
if i = 3 then
begin
case v of
1:bin:= 2;
0:bin:= 0;
else
write('ERROR');
end;
end;
Else
begin
case v of
1:bin:= 1;
0:bin:= 0;
else
write('ERROR');
end;
cont:= cont + bin;
read(sec, v);
end;
case cont of
begin // convierte la suma decimal en hexadecimal
0 : write(salida,'0');
1 : write(salida,'1');
2 : write(salida,'2');
3 : write(salida,'3');
4 : write(salida,'4');
5 : write(salida,'5');
6 : write(salida,'6');
7 : write(salida,'7');
8 : write(salida,'8');
9 : write(salida,'9');
10 : write(salida,'A');
11 : write(salida,'B');
12 : write(salida,'C');
13 : write(salida,'D');
14 : write(salida,'E');
15 : write(salida,'F');
else
write('ERROR');
end;
cont:= 0;
y:= y+1;
read(sec, v);
if y = 2 then
begin
write(salida, '-');
y:= 0;
read(sec, v);
end;
end;
writeln('**********************************************************************');
writeln('Proceso terminado con mucho exito!');
writeln('**********************************************************************');
readkey;
close(sec);
close(salida);
end.
Valora esta pregunta
0