Advertisement
Guest User

Untitled

a guest
Jun 8th, 2019
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ada 1.65 KB | None | 0 0
  1. Procedure printSentenceInChatStream is
  2. -- Variable declaration
  3. -- Each element of the array will be a string of characters like mySentecesList:= ("hi world", "Hi mate, how are you", "etc")
  4.     mySentencesList = type array();
  5.     x = type integer; -- Minimum value of variable x will be the first element of the array and maximum value will be the max lengh of the array
  6.     timer = type time; -- each 15 minutes or 10 min
  7.  
  8. -- Declaration of functions and procedures
  9. function randomIntegerNumber (sentences: type array) return integer
  10.     x = type integer;
  11.     -- the vaule of x will be an integer beetwen first element of the array and the last element of the array
  12.     x:= random(sentences.FirstElementOfTheArray(), sentences.LastElementOfTheArray());
  13. return x;
  14.  
  15. Procedure checkPassedtime (timePassed: type time) is
  16.     timer: type time;
  17.     timer:= timePassed;
  18.     -- here some operations for check passed time
  19. end procedure;
  20.  
  21. #start program
  22. begin
  23. mySentencesList.addElement:= ("Hi world");
  24. mySentencesList.addElement:= ("Few are those who see with their own eyes and feel with their own hearts.");
  25. mySentencesList.addElement:= ("Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world.");
  26. mySentencesList.addElement:= ("Unthinking respect for authority is the greatest enemy of truth.");
  27. mySentencesList.addElement:= ("Try not to become a man of success, but rather try to become a man of value.");
  28. mySentencesList.addElement:= ("I am by heritage a Jew, by citizenship a Swiss...");
  29.  
  30. x:= randomIntegerNumber(mySentencesList());
  31. If checkPassedTime(timer) then
  32.     printChatMessage(mySentenceList(x));
  33. en if;
  34. รง
  35. end printSentenceInChatStream;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement