I am compiling a program for class, which has to show from the data that I enter the winning snail.
program Entregable2;
type //Definir tipos de datos
tiempo = record
h : 0..23;
m : 0..59;
end;
participante = record
nombre :string;
dorsal : 1..4;
hora :tiempo;
duracion :tiempo;
velocidad :real
end;
var //Declaracion de variables
Caracol: array [1..4] of Participante;
i: integer;
Salida:tiempo;
procedure vel(HoraS,MinS,HoraLl,MinLl :integer; var Caracol:Participante ) ; //Calcular la velocidad del caracol
begin
if MinS>MinLl then
begin
MinLl:=MinLl+60;
HoraLl:=HoraLl-1
end;
Caracol.duracion.m:= MinLl-MinS;
if HoraS>HoraLl then HoraLl:=HoraLl+24;
Caracol.duracion.h:= HoraLl-HoraS;
Caracol.velocidad:= 50/(Caracol.duracion.h*60+Caracol.duracion.m);
end;
procedure Iden(sal:tiempo;Caracol:participante); //Identificar participante
begin
writeln('Introduce el nombre');
readln(Caracol.nombre);
writeln('Introduce el dorsal');
readln(Caracol.dorsal);
writeln('Introduce la hora a la que ha llegado, y después los minutos');
readln(Caracol.hora.h);
readln(Caracol.hora.m);
vel(sal.h,sal.m,Caracol.hora.h,Caracol.hora.m,Caracol);
end;
procedure Ganador(Caracol:array of Participante); //Identificar ganador
var
i: integer;
a: integer;
b: integer;
begin
for i:=1 to 4 do
begin
if i=1 then
begin
a:=Caracol[i].duracion.h*60+Caracol[i].duracion.m;
b:=i
end
else
begin
if a>(Caracol[i].duracion.h*60+Caracol[i].duracion.m) then
begin
a:=Caracol[i].duracion.h*60+Caracol[i].duracion.m;
b:=i;
end;
end;
end;
writeln('El caracol ganador es el número ', b,', que ha tardado un total de ', caracol[b].duracion.h,' horas y ', caracol[b].duracion.m, ' minutos, a una velocidad de ' ,caracol[b].velocidad:4:4, ' cm/m.');
end;
begin //Inicio del programa
writeln('Introduce la hora de salida, y después los minutos');
readln(Salida.h);
readln(Salida.m);
for i:=1 to 4 do
begin
Iden(salida, Caracol[i]);
end;
Ganador(Caracol);
end.
This is the line where I get the Error .
Iden(salida, Caracol[i]);
And it tells me that the variable Snail is not starting. Thanks!