Advertisement
Guest User

Untitled

a guest
Dec 5th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.96 KB | None | 0 0
  1. %Ms.Nicosia
  2. %ICS20-01
  3. %Capitals of provinces
  4.  
  5.  
  6. %declaring variables
  7. var guess : string
  8. var tries:real:=0
  9. var right:int:=0
  10. %For command
  11. for times : 1 .. 3
  12. %Getting variable values
  13. put "What is the capital city of Ontario? (You only have 3 guesses) " ..
  14. get guess
  15.  
  16. %if statement
  17. if guess = "Toronto" then
  18. right:=right+1
  19. put "Right!"
  20. exit
  21. else
  22. put "Sorry wrong answer."
  23.  
  24. end if
  25. tries:=tries+1
  26. end for
  27. put " Tries: ", tries
  28.  
  29. %For command
  30. for times : 1 .. 3
  31. %Getting variable values
  32. put "What is the capital city of Alberta? (You only have 3 guesses) " ..
  33. get guess
  34.  
  35. %if statement
  36. if guess = "Edmonton" then
  37. right:=right+1
  38. put "Right!"
  39. exit
  40. else
  41. put "Sorry wrong answer."
  42.  
  43. end if
  44. tries:=tries+1
  45. end for
  46. put " Tries: ", tries
  47. %For command
  48. for times : 1 .. 3
  49. %Getting variable values
  50. put "What is the capital city of Nova Scotia? (You only have 3 guesses) " ..
  51. get guess
  52.  
  53. %if statement
  54. if guess = "Halifax" then
  55. right:=right+1
  56. put "Right!"
  57. exit
  58. else
  59. put "Sorry wrong answer."
  60.  
  61. end if
  62. tries:=tries+1
  63. end for
  64. put " Tries: ", tries
  65.  
  66. %For command
  67. for times : 1 .. 3
  68. %Getting variable values
  69. put "What is the capital city of Saskatchewan? (You only have 3 guesses) " ..
  70. get guess
  71.  
  72. %if statement
  73. if guess = "Regina" then
  74. right:=right+1
  75. put "Right!"
  76. exit
  77. else
  78. put "Sorry wrong answer."
  79.  
  80. end if
  81. tries:=tries+1
  82. end for
  83. put " Tries: ", tries
  84.  
  85. %For command
  86. for times : 1 .. 3
  87. %Getting variable values
  88. put "What is the capital city of Manitoba? (You only have 3 guesses) " ..
  89. get guess
  90.  
  91. %if statement
  92. if guess = "Winnepeg" then
  93. right:=right+1
  94. put "Right!"
  95. exit
  96. else
  97. put "Sorry wrong answer."
  98.  
  99. end if
  100. tries:=tries+1
  101. end for
  102. put " Tries: ", tries
  103.  
  104. %For command
  105. for times : 1 .. 3
  106. %Getting variable values
  107. put "What is the capital city of Quebec? (You only have 3 guesses) " ..
  108. get guess
  109.  
  110. %if statement
  111. if guess = "Quebec City" then
  112. right:=right+1
  113. put "Right!"
  114. exit
  115. else
  116. put "Sorry wrong answer."
  117.  
  118. end if
  119. tries:=tries+1
  120. end for
  121. put " Tries: ", tries
  122.  
  123. %For command
  124. for times : 1 .. 3
  125. %Getting variable values
  126. put "What is the capital city of British Columbia? (You only have 3 guesses) " ..
  127. get guess
  128.  
  129. %if statement
  130. if guess = "Victoria" then
  131. right:=right+1
  132. put "Right!"
  133. exit
  134. else
  135. put "Sorry wrong answer."
  136.  
  137. end if
  138. tries:=tries+1
  139. end for
  140. put " Tries: ", tries
  141.  
  142. %For command
  143. for times : 1 .. 3
  144. %Getting variable values
  145. put "What is the capital city of Newfoundland and Labrador? (You only have 3 guesses) " ..
  146. get guess
  147.  
  148. %if statement
  149. if guess = "St. Johns" then
  150. right:=right+1
  151. put "Right!"
  152. exit
  153. else
  154. put "Sorry wrong answer."
  155.  
  156. end if
  157. tries:=tries+1
  158. end for
  159. put " Tries: ", tries
  160.  
  161. %For command
  162. for times : 1 .. 3
  163. %Getting variable values
  164. put "What is the capital city of PEI? (You only have 3 guesses) " ..
  165. get guess
  166.  
  167. %if statement
  168. if guess = "Charlotte Town" then
  169. right:=right+1
  170. put "Right!"
  171. exit
  172. else
  173. put "Sorry wrong answer."
  174.  
  175. end if
  176. tries:=tries+1
  177. end for
  178. put " Tries: ", tries
  179.  
  180. %For command
  181. for times : 1 .. 3
  182. %Getting variable values
  183. put "What is the capital city of New Brunswik? (You only have 3 guesses) " ..
  184. get guess
  185.  
  186. %if statement
  187. if guess = "Fredericton" then
  188. right:=right+1
  189. put "Right!"
  190. exit
  191. else
  192. put "Sorry wrong answer."
  193.  
  194. end if
  195. tries:=tries+1
  196. end for
  197. put " Tries: ", tries
  198. put " The average of the amount of one's you got right is ",(right/10)*100,"%."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement