Advertisement
manuwwa

zadanie1lab2

Apr 1st, 2015
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ada 0.93 KB | None | 0 0
  1. -- Niesynchronizaowane działanie dwóch zadań
  2.  
  3. with Ada.Text_IO; use Ada.Text_IO;
  4. with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
  5. with RandomPackage; use RandomPackage;
  6. with MyTime; use MyTime;
  7. --with Screen; use Screen;
  8. with WinConsoleEx; use WinConsoleEx;
  9.  
  10. Procedure main is
  11.  
  12. task Zadaniea;
  13. task body zadaniea is
  14. D:Duration;
  15. czas,czasmax,i:integer;
  16. Begin
  17. czasmax:=100;
  18.  
  19. i:=1;
  20. loop
  21. czas:=RandomInt(czasmax);
  22. D:=Duration(Float(czas)/100.0);
  23. delay D;
  24. MoveCursor(i,10);
  25. Put("zadaniea");Put(i,2);Put("raz;przerwa");Put(czas,3);
  26. exit when i=10;
  27. i:=i+1;
  28. end loop;
  29. end Zadaniea;
  30. task Zadaniea1;
  31. task body zadaniea1 is
  32. D:Duration;
  33. czas,czasmax,i:integer;
  34. Begin
  35. czasmax:=100;
  36.  
  37. i:=1;
  38. loop
  39. czas:=RandomInt(czasmax);
  40. D:=Duration(Float(czas)/100.0);
  41. delay D;
  42. MoveCursor(i,10);
  43. Put("zadaniea1");Put(i,2);Put("raz;przerwa");Put(czas,3);
  44. exit when i=10;
  45. i:=i+1;
  46. end loop;
  47. end Zadaniea1;
  48. begin
  49. NULL;
  50. end main;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement