Разработка программы «Киноафиши» на языке Turbo Pascal 7.1, страница 5

          n1:=temp^.x.nom;

             n11:=temp^.x.film;

             n2:=temp^.x.ori;

             n3:=temp^.x.year;

             n4:=temp^.x.gen;

             n5:=temp^.x.prod;

             n6:=temp^.x.dur;

             n7:=temp^.x.lim;

             n8:=temp^.x.sit;

             n9:=temp^.x.act;

             n10:=temp^.x.rat;

             writeln;

             vvod_zn(c);

          temp^.x:=c;

             if temp^.x.film='0' then temp^.x.film:=n11;

             if temp^.x.ori='0' then temp^.x.ori:=n2;

             if temp^.x.year=0 then temp^.x.year:=n3;

             if temp^.x.gen='0' then temp^.x.gen:=n4;

             if temp^.x.prod='0' then temp^.x.prod:=n5;

             if temp^.x.dur=0 then temp^.x.dur:=n6;

             if temp^.x.lim=0 then temp^.x.lim:=n7;

             if temp^.x.sit='0' then temp^.x.sit:=n8;

             if temp^.x.act='0' then temp^.x.act:=n9;

             if temp^.x.rat=0 then temp^.x.rat:=n10;

          temp^.x.nom:=n1;

             end;

         clrscr;window(1,12,80,25);clrscr; n:=0;

end;

procedure del_(var top:p; var n:integer);

var t,temp:p; i,otv:integer; b:zap;

begin i:=1;

IF top=nil then begin window(1,10,20,15);writeln('  Empty!!!');end

         else

  if n=0 then begin window(1,10,30,15);writeln('  First find the element.'); readkey; end

      else

  begin

    temp:=top;

    for i:=1 to n-1 do temp:=temp^.y;

    window(1,15,80,25); clrscr;

    show_tabl_up; show_elem(temp); show_tabl_down;

    write('  Delate? (1-Yes/0-No) - '); readln(otv); end;

    If otv=1 then begin

              for i:=1 to n-1 do temp:=temp^.y;

              IF n=1 then begin temp:=top^.y; dispose(top); top:=temp; end

                  else begin

                      temp:=top; for i:=1 to n-2 do temp:=temp^.y;

                      t:=temp^.y^.y; dispose(temp^.y); temp^.y:=t;

                       end;

              temp:=top; i:=1;

              while temp<>nil do

              begin

                temp^.x.nom:=i;

                i:=i+1; temp:=temp^.y;

              end;

  end;

readkey; n:=0;

end;

procedure sort(var top:p);

var temp:p;i,j,imin,n:integer;a1:real;a:array [1..30] of real;

begin n:=0;i:=1;j:=1;

    IF top=nil then begin window(1,10,20,15);writeln('  Table is empty!');end

               else

    begin temp:=top;while temp<>nil do

       begin n:=n+1;a[i]:=temp^.x.rat;temp:=temp^.y;i:=i+1;

       end;

               for i:=1 to n do

                begin imin:=i;

                      for j:=i+1 to n do

                if a[j]>a[imin] then imin:=j;

                a1:=a[i]; a[i]:=a[imin];a[imin]:=a1;

                end;

         window(1,10,80,25) ;clrscr;

         show_tabl_up;

         for i:=1 to n do begin temp:=top;

         while temp^.x.rat<>a[i] do temp:=temp^.y;

        write('і',temp^.x.nom:2);

     write('і',temp^.x.film:7);

     write('і',temp^.x.ori:6);

     write('і',temp^.x.year:4);

     write('і',temp^.x.gen:5);

     write('і',temp^.x.prod:8);

     write('і     ',temp^.x.dur:3);

     write('і',temp^.x.lim:3);

     write('і',temp^.x.sit:10);

     write('і',temp^.x.act:8);

     write('і  ',temp^.x.rat:3:2);

     writeln('і');  end;

         Show_tabl_down;

end;

    readkey;clrscr;

end;

procedure max_(var top:p; poz_max:integer);

var temp:p; i,k,otv:integer; max:real;

begin

  max:=0; k:=0;

  IF top=nil then begin window(1,10,20,15);writeln('  Table is empty!');end

          else

  begin

    temp:=top;

    while temp<>nil do

      begin

     case poz_1 of

     1: If temp^.x.dur>max then max:=temp^.x.dur;

     2: If temp^.x.lim>max then max:=temp^.x.lim;

     3: If temp^.x.rat>max then max:=temp^.x.rat;

     end;

     temp:=temp^.y;

      end;

    window(1,12,39,25);

    writeln('Maximum = ',max:4:2); readkey;

    writeln('Would you like to see table?');

    write('(1-Yes/0-No) - '); readln(otv); clrscr;

    if otv=1 then begin