Advertisement
Guest User

Untitled

a guest
Sep 13th, 2017
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. MODULE zad1;
  2. FROM Stek IMPORT Stack, MakeNull, Empty, Push, Top, Pop;
  3. FROM FIO IMPORT RdStr, WrStr, WrLn, File, Create, Append, Open, Close ;
  4. VAR
  5. f:File;
  6. ok,EOL,EOF: BOOLEAN;
  7. str:ARRAY[1..20] OF CHAR;
  8. stek1,stek2,stek3:Stack;
  9.  
  10. BEGIN
  11. f:=Open('veliki.txt');
  12. MakeNull(stek1);
  13. MakeNull(stek2);
  14. MakeNull(stek3);
  15. WHILE NOT EOL DO
  16. RdStr(f,str);
  17. Push(stek1,str,ok);
  18. END;
  19. Close(f);
  20. WHILE NOT Empty(stek1) DO
  21. Top(stek1,str,ok);
  22. Pop(stek1,ok);
  23. Push(stek2,str,ok);
  24. Top(stek1,str,ok);
  25. Pop(stek1,ok);
  26. Push(stek3,str,ok);
  27. END;
  28. f:=Create('mali1.txt');
  29. f:=Append('mali1.txt');
  30. WHILE NOT Empty(stek2) DO
  31. Top(stek2,str,ok);
  32. WrStr(f,str);
  33. WrLn(f);
  34. Pop(stek2,ok);
  35. END;
  36. Close(f);
  37. f:=Create('mali2.txt');
  38. f:=Append('mali2.txt');
  39. WHILE NOT Empty(stek3) DO
  40. Top(stek3,str,ok);
  41. WrStr(f,str);
  42. WrLn(f);
  43. Pop(stek3,ok);
  44. END;
  45. Close(f);
  46. END zad1.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement