I haven't found the culprit yet but i did run into something else.
What happens if the file airport_condition.txt is empty ?
Procedure input_platform_condition(Var num:integer);
Var x,counter: integer;
Begin
num := 0;
For x:=1 To 30
Do platform[x].airplane_no := '';
assign(platformfile,'airport_condition.txt');
reset(platformfile);
counter := 0;
While counter<30 Do
Begin
counter := counter+1;
With platform[num] Do
Begin
readln(platformfile,airplane_no);
readln(platformfile,airplane_predicted_time_left);
If (airplane_no<>'$$$')
Then num := num+1;
End;
End;
close(platformfile);
End;
The code simply assumes that when the plane is not $$$ that it is a plane, which is wrong in case the statement
readln(platformfile,airplane_no); produced an empty airplane_no.
Fix that by:
If ( (airplane_no<>'$$$') and (airplane_no <> '') )
Then num := num+1;
As i assume it is allowed to have no planes at all at the airport (and only have planes in the air, waiting for landing).
And that leads to another problem, namely that you start-loop is stuck when this condition happens
Because if there are no planes at the airport, the routine input_platform_condition returns the num variable (which is then zero).
Take a look at your loop:
While num>=0 Do
Begin
// blah
Case ch Of
#13:
Begin
If (num=0) And (count2=0) Then
begin
// blah
end;
If (num<>0) And (count2<>0) Then
Begin
// blah
End;
End;
End;
Num is the number of planes at the airport (which is zero), and count2 is the number of planes in the air (three given your example file).
None of these conditions is met and, the loop will go on forever without actually doing anything.