Advertisement
Guest User

Untitled

a guest
Jan 28th, 2020
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. program NAZWA_PROGRAMU;
  2. {$APPTYPE CONSOLE}
  3. uses SysUtils;
  4.  
  5. TYPE PElem = ^TElem;
  6. TElem = RECORD
  7. imie : string;
  8. nazwisko : string;
  9. wsk :PElem;
  10. END;
  11.  
  12. VAR poczatek,koniec:PElem;
  13. n:integer;
  14. temp,q:PElem;
  15.  
  16.  
  17.  
  18. procedure WypiszKolejke;
  19. begin
  20. WHILE poczatek<>NIL DO
  21. begin
  22. temp:=poczatek^.wsk;
  23. writeln('Imie pacjenta: ',poczatek^.imie);
  24. writeln('Nazwisko pacjenta: ',poczatek^.nazwisko);
  25. writeln;
  26. poczatek:=temp;
  27. end; writeln;
  28. end;
  29.  
  30. procedure TworzKolejke(n:integer);
  31. var k:integer;
  32. begin
  33. poczatek:=NIL; koniec:=NIL;
  34. k:=n;
  35. WHILE k>0 DO
  36. begin
  37. NEW(q);
  38. q^.wsk:=poczatek;
  39. poczatek:=q;
  40. writeln('Imie pacjenta?');
  41. readln(poczatek^.imie);
  42. writeln('Nazwisko pacjenta?');
  43. readln(poczatek^.nazwisko);
  44. writeln;
  45. IF k=n THEN koniec:=poczatek;
  46. k:=k-1;
  47. end;
  48. end;
  49.  
  50.  
  51.  
  52. Begin
  53. write('Podaj jak dluga jest kolejka pacjentow ');
  54. readln(n);
  55. TworzKolejke(n);
  56. WypiszKolejke;
  57. readln;
  58. End.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement