Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. main :-
  2. new(Dialog, dialog('Osoby')),
  3. send_list(Dialog, append,
  4. [new(N1, text_item(imie_osoby)),
  5. new(N2, text_item(preferencja1)),
  6. new(N3, text_item(preferencja2)),
  7. button(zapisz, and(message(@prolog,
  8. zapisz1,
  9. N1?selection,
  10. N2?selection,
  11. N3?selection),
  12. message(Dialog, destroy)))]),
  13. send(Dialog, default_button, zapisz),
  14. send(Dialog, open).
  15.  
  16. zapisz1(N1, N2, N3) :-
  17. N1 =.. L1,
  18. N2 =.. K2,
  19. N3 =.. K3,
  20. append(K2, K3, L2),
  21. %szkicuj(L2),
  22. new(Dialog1, dialog('Osoby2')),
  23. send_list(Dialog1, append,
  24. [new(M1, text_item(imie_osoby)),
  25. new(M2, text_item(preferencja1)),
  26. new(M3, text_item(preferencja2)),
  27. button(zapisz, and(message(@prolog,
  28. zapisz2,
  29. M1?selection,
  30. M2?selection,
  31. M3?selection,
  32. L1, L2),
  33. message(Dialog1, destroy)))]),
  34. send(Dialog1, default_button, zapisz),
  35. send(Dialog1, open).
  36.  
  37. zapisz2(N1, N2, N3, L11, L22) :-
  38. N1 =.. K1,
  39. N2 =.. K2,
  40. N3 =.. K3,
  41. L11 =.. K4,
  42. L22 =.. K5,
  43. append(K4, K1, L1),
  44. append(K2, K3, L3),
  45. append(K5, L3, L2),
  46. new(Dialog2, dialog('Osoby')),
  47. send_list(Dialog2, append,
  48. [new(M1, text_item(imie_osoby)),
  49. new(M2, text_item(preferencja1)),
  50. new(M3, text_item(preferencja2)),
  51. button(zapisz, and(message(@prolog,
  52. zapisz2,
  53. M1?selection,
  54. M2?selection,
  55. M3?selection,
  56. L1, L2),
  57. message(Dialog2, destroy))),
  58. button(koniec, and(message(@prolog,
  59. zapisz3,
  60. L1, L2),
  61. message(Dialog2, destroy)))]),
  62. send(Dialog2, default_button, zapisz),
  63. send(Dialog2, open).
  64.  
  65. zapisz3(L1, L2) :-
  66. L1 =.. K1,
  67. L2 =.. K2,
  68. length(K1, X1),
  69. length(K2, X2),
  70. new(F1, file('plik1.txt')),
  71. send(F1, open, write),
  72. send(F1, append, X1),
  73. send(F1, close),
  74. new(F2, file('plik2.txt')),
  75. send(F2, open, write),
  76. send(F2, append, X2),
  77. send(F2, close).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement