После введения с клавиатуры некоторых мероприятий и рядом время их проведения выдать на экран правильный регламент дня. Формат времени чч:мм(с 00:00 до 23:59). В первом столбике регламента вывести время — Pascal(Паскаль)

Program raspis;
Uses Crt;
Var spisok  : array [1..10] of string;
    time, comment : string;
    time_enter,sort: boolean;
    enter, buf1, buf2 : string;
 
    i,j,m,mas : integer;
 
 
Begin
ClrScr;
Repeat
Writeln('1 - look spisok; 2 - add line in spisok; 3 - exit.');
ReadLn(m);
 
time:=''; comment:='';
Case m of
     1: begin
           ClrScr;
           for i:=1 to mas do
               begin
                  WriteLn(spisok[i]);
               end;
        end;
     2: begin
           ClrScr;
           Writeln('Enter new line');
           ReadLn(enter);
           For i:=1 to length(enter) do
               begin
                  if (enter[i]=':') and
                     ((enter[i-2]<'0') or
                     ((enter[i-2]>='0') and (enter[i-2]<='2')) and
                     ((enter[i-1]>='0') and (enter[i-1]<='9')) and
                     ((enter[i+1]>='0') and (enter[i+1]<='5')) and
                     ((enter[i+2]>='0') and (enter[i+2]<='9')))  then
                     begin
                        for j:=0 to 4 do
                            begin
                               if (j=0) and (i=2) then time:='0'
                               else time:=time+enter[i-2+j];
                            end;
                        time_enter:=true;
                        if (i=2) or (i=3) then
                           begin
                              comment:='';
                              i:=i+3;
                           end
                        else
                           begin
                              comment[i-2]:=chr(0);
                              comment[i-1]:=chr(0);
                              i:=length(enter);
                           end;
                     end
                  else
                    begin
                       comment:=comment+enter[i];
                    end;
               end;
           if time_enter=true then
              begin
                 if mas<>0 then
                    begin
                       for i:=1 to mas+1 do
                           begin
                              if sort=false then
                                 begin
                                    buf1:=spisok[i,1]+spisok[i,2]+spisok[i,3]+spisok[i,4]+spisok[i,5];
                                    if time<buf1 then
                                       begin
                                          sort:=true;
                                          buf1:=spisok[i];
                                          spisok[i]:=time+' - '+comment;
                                       end;
                                 end
                              else
                                begin
                                   buf2:=spisok[i];
                                   spisok[i]:=buf1;
                                   buf1:=buf2;
                                end;
                              if (i=mas+1) and (sort=false) then spisok[i]:=time+' - '+comment;
                           end;
                    end
                 else
                    begin
                       spisok[1]:=time+' - '+comment;
                    end;
                 ClrScr;
              end
           else Writeln('You not do enter TIME. You line not save');
           Sort:=False;
           time_enter:=false;
           mas:=mas+1;
        end
     else
        begin
           ClrScr;
           Writeln('Error enter comando');
        end;
     end;
Until m=3;
 
 
End.

Leave a Comment

3 + 1 =