program Noname1; uses crt; type klientas=^kli; kli=record familija:packed array [1..10] of char; imia: packed array [1..10] of char; 4islo: packed array [1..10] of char; sutok:integer; tip_komnaty:(k1,k2,k3,k4); stoimist:longint; cena:integer; next:klientas; back:klientas; end; var kl,nachalo,konec:klientas; c,c2:char; n,k,m,l,code,minind,z:integer; s:string; t1,t2:text; begin textcolor(blue); textbackground(lightgray); clrscr; writeln(' '); writeln(' ______ _ _ _ _ '); writeln(' | ___ \ | | | | | | | | '); writeln(' | |_/ /_ __ ___ __ _ _ __ __ _ _ __ ___ | |_| | ___ | |_ ___ | | '); writeln(' | __/| `__|/ _ \ / _` || `__|/ _` || `_ ` _ \ | _ | / _ \ | __|/ _ \| | '); writeln(' | | | | | (_) || (_| || | | (_| || | | | | | | | | || (_) || |_| __/| | '); writeln(' \_| |_| \___/ \__, ||_| \__,_||_| |_| |_| \_| |_/ \___/ \__|\___||_| '); writeln(' __/ | '); writeln(' |___/ '); writeln(' '); writeln(' 2 Grupe '); writeln(); Writeln('Dobryj den! Eta programa formiruet spisok zhitelej,' + ' uporiadochivaet ih po stoimosti i pe4ataet 2 tablicy:' + ' dannyh i rezultatov vy4islenija'); writeln(); writeln('4toby dvigacca dal6e - zhmite probel'); if readkey=' ' then clrscr; assign(t1,'1.txt'); assign(t2,'2.txt'); reset(t1); reset(t2); readln(t1); readln(t1); readln(t1); nach := nil; konc := nil; while not eof(t1) do begin while not eoln(t1) do begin new(kl); while c<>' ' do begin k:=k+1; read(t1,c); kl^.imia[k]:=c; end; k:=0; while c=' ' do read(t1,c); while c<>' ' do begin k:=k+1; kl^.familija[k]:=c; read(t1,c); end; while c=' ' do read(t1,c); k:=0; while c<>' ' do begin k:=k+1; kl^.4islo[k]:=c; read(t1,c); end; while c=' ' do read(t1,c); k:=0; while c<>' ' do begin k:=k+1; s[k]:=c; val(s[k],m,code); if z<>0 then z:=z*10+m else z:=m; read(t1,c); end; kl^.sutok:=z; while c=' ' do read(t1,c); if c='1' then kl^.tip_komnaty:=k1 else if c='2' then kl^.tip_komnaty:=k2 else if c='3' then kl^.tip_komnaty:=k3 else kl^.tip_komnaty:=k4; k:=0; kl^.next:=nil; if nachalo=nil then begin kl^.back:=nil; nachalo:= kl; konec:= kl; end else begin kl^.back:=nachalo; konec^.next:=kl; konec:=kl; end; readln(t1);z:=0; end; end; writeln('Spisok uspe6no sozdan'); z:=0; kl:=nachalo; while kl <> nil do begin close(t2); reset(t2); readln(t2); readln(t2); if kl^.tip_komnaty=k1 then begin while c<>' ' do read(t2,c); read(t2,c); while not eoln(t2) do begin l:=l+1; s[l]:=c; val(s[l],m,code); z:=z*10+m; read(t2,c); end; kl^.cena:=z; z:=0; end else if kl^.tip_komnaty=k2 then begin readln(t2); while c<>' ' do read(t2,c); read(t2,c); while not eoln(t2) do begin l:=l+1; s[l]:=c; val(s[l],m,code); z:=z*10+m; read(t2,c); end; kl^.cena:=z; z:=0; end else if kl^.tip_komnaty=k3 then begin readln(t2); readln(t2); while c<>' ' do read(t2,c); read(t2,c); while not eoln(t2) do begin l:=l+1; s[l]:=c; val(s[l],m,code); z:=z*10+m; read(t2,c); end; kl^.cena:=z; z:=0; end else begin readln(t2); readln(t2); readln(t2); while c<>' ' do read(t2,c); read(t2,c); while not eoln(t2) do begin l:=l+1; s[l]:=c; val(s[l],m,code); z:=z*10+m; read(t2,c); end; kl^.cena:=z; z:=0; end; if n=1 then begin n:=0; end; kl:=kl^.next; end; kl:=nachalo; while kl <> nil do begin kl^.stoimost:=kl^.cena*kl^.sutok; kl:=kl^.next; end; writeln(); writeln('tablica dannyh:'); writeln(); writeln('-------------------------------------------------------------------------------'); writeln(' imia | familija | 4islo | dnej | tip komnaty | cena |'); writeln('-------------------------------------------------------------------------------'); kl:=nachalo; while kl <> nil do begin if m<>1 then begin writeln(); m:=1; end; for k:=1 to 10 do write(kl^.imia[k]); write('| '); for k:=1 to 10 do write(kl^.familija[k]); write(' | '); for k:=1 to 10 do write(kl^.4islo[k]); write('|'); if kl^.sutok<99 then write(' ',kl^.sutok) else write(' ',kl^.sutok); if kl^.sutok<10 then write(' '); write(' |'); if kl^.tip_komnaty=k1 then write(' 1 kambario numeris|') else if kl^.tip_komnaty=k2 then write(' 2 kambariu numeris|') else if kl^.tip_komnaty=k3 then write(' 3 kambariu numeris|') else write(' 4 kambariu numeris|'); write(' ',kl^.cena,' lt |'); kl:=kl^.next; end;writeln; writeln('------------------------------------------------------------------------------- '); writeln('hotite dal6e - zhmite probel '); if readkey=' ' then clrscr; writeln(); writeln('Tablica rezultatov vy4islenija:'); writeln(); writeln('----------------------------------------------'); writeln(' imia | familija | stoimost |'); writeln('----------------------------------------------'); kl:=nachalo; while kl <> nil do begin if m<>1 then begin writeln(); m:=1; end; for k:=1 to 10 do write(kl^.imia[k]); write('| '); for k:=1 to 10 do write(kl^.familija[k]); write(' | '); write(' ',kl^.stoimost); if kl^.stoimost<999 then write(' ') else if kl^.stoimost<9999 then write(' '); write(' lt'); write(' |'); kl:=kl^.next; end; writeln(); writeln('----------------------------------------------'); writeln(); writeln('Aciu uz demesi! Noredami baigti darba, paspauskite enter'); if readkey<>#13 then writeln('viso gero'); end.