Advertisement
kqlul123

Untitled

Mar 25th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.69 KB | None | 0 0
  1. Option Explicit
  2.  
  3. Private Type Gold
  4. countryname As String * 15
  5. year(5) As Integer
  6. max As Integer
  7. maxyear As Integer
  8. average As Integer
  9. End Type
  10.  
  11. Dim a1 As Gold
  12. Dim a2 As Gold
  13. Dim cout As String
  14. Dim endl As String
  15. Dim n As Integer
  16. Dim ind As Integer
  17. Dim num As Integer
  18. Dim st As Integer
  19. Dim sum As Currency
  20. Dim k As Integer
  21. Dim summ As Currency
  22. Dim s As String
  23.  
  24.  
  25.  
  26.  
  27. Private Sub btnDelete_Click()
  28. ind = ListBox1.ListIndex
  29. ListBox1.RemoveItem ind
  30. btnDelete.Enabled = False
  31. End Sub
  32.  
  33. Private Sub btnEdit_Click()
  34.  
  35. End Sub
  36.  
  37. Private Sub btnExit_Click()
  38. End
  39. End Sub
  40.  
  41. Private Sub btnInput_Click()
  42. TB1.Enabled = True
  43. TB2.Enabled = True
  44. TB3.Enabled = True
  45. TB4.Enabled = True
  46. TB5.Enabled = True
  47. TB6.Enabled = True
  48. TB1.Text = ""
  49. TB2.Text = ""
  50. TB3.Text = ""
  51. TB4.Text = ""
  52. TB5.Text = ""
  53. TB6.Text = ""
  54. btnInput.Enabled = False
  55. btnOK.Enabled = True
  56.  
  57.  
  58. End Sub
  59.  
  60. Private Sub btnList_Click()
  61. Dim l As Integer
  62. Dim i As Integer
  63.  
  64. l = Len(a1.countryname)
  65. s = a1.countryname + Space(15 - l)
  66. For i = 1 To 5
  67. l = Len(Str(a1.year(i)))
  68. s = s + Str(a1.year(i)) + Space(4 - l)
  69. Next i
  70. l = Len(Str(a1.average))
  71. s = s + Str(a1.average) + Space(7 - l)
  72. l = Len(Str(a1.max))
  73. s = s + Str(a1.max) + Space(8 - l)
  74. l = Len(Str(a1.maxyear))
  75. s = s + Str(a1.maxyear) + Space(8 - l)
  76.  
  77.  
  78. ListBox1.AddItem s
  79. btnO.Enabled = True
  80. btnList.Enabled = False
  81. btnInput.Enabled = True
  82. End Sub
  83.  
  84. Private Sub btnO_Click()
  85. n = ListBox1.ListCount
  86. SK = 0
  87. SC = 0
  88. SSR = 0
  89. max = 0
  90. maxindex = 0
  91. For i = 0 To n
  92. ind = i
  93. If i = n Then ind = maxind
  94. st = ListBox1.List(ind)
  95. nom = 0
  96. s = ""
  97. For k = 1 To Len(st)
  98. c = Mid(st, k, 1)
  99. If c <> " " Then s = s + c
  100. If c = " " And s <> " " Then
  101. nom = nom + 1
  102.  
  103. Select Case nom
  104. Case 1: a1.countryname = s
  105. Case 2: a1.year(1) = Val(s)
  106. Case 3: a1.year(2) = Val(s)
  107. Case 4: a1.year(3) = Val(s)
  108. Case 5: a1.year(4) = Val(s)
  109. Case 6: a1.year(5) = Val(s)
  110. End Select
  111. s = ""
  112. End If
  113. Next k
  114.  
  115.  
  116. If a1.average > max Then
  117. max = a1.average
  118. maxind = ind
  119. End If
  120.  
  121. If i < n Then
  122. src1 = src1 + a1.year(1)
  123. src2 = src2 + a1.year(2)
  124. src3 = src3 + a1.year(3)
  125. srSR = srSR + a1.sr
  126. End If
  127. Next i
  128.  
  129. If n > 0 Then
  130. src1 = src1 / n
  131. src2 = src2 / n
  132. src3 = src3 / n
  133. src4 = src4 / n
  134. src5 = src5 / n
  135. srSR = srSR / n
  136. End If
  137.  
  138.  
  139. s = "Ñðåä. çíà÷"
  140. l = Len(Str(src1))
  141. s = s + Str(src1) + Space(8 - 1)
  142. l = len(str(src2)
  143.  
  144.  
  145. End Sub
  146.  
  147. Private Sub btnOK_Click()
  148. endl = Chr(13) + Chr(10)
  149. Dim i As Integer
  150. a1.average = 0
  151. For i = 1 To 5
  152. a1.average = a1.average + a1.year(i)
  153. Next i
  154. a1.average = a1.average / 5
  155.  
  156. a1.max = a1.year(1)
  157. a1.maxyear = 1
  158. If a1.year(2) > a1.max Then a1.max = a1.year(2): a1.maxyear = 2
  159. If a1.year(3) > a1.max Then a1.max = a1.year(3): a1.maxyear = 3
  160. If a1.year(4) > a1.max Then a1.max = a1.year(4): a1.maxyear = 4
  161. If a1.year(5) > a1.max Then a1.max = a1.year(5): a1.maxyear = 5
  162.  
  163. btnList.Enabled = True
  164.  
  165.  
  166. cout = "Íàçâàíèå còðàíû: " + a1.countryname + endl
  167. cout = cout + "Çîëîòîäîáû÷à:" + endl
  168. cout = cout + "Ãîä 1 - " + Str(a1.year(1)) + endl
  169. cout = cout + "Ãîä 2 - " + Str(a1.year(2)) + endl
  170. cout = cout + "Ãîä 3 - " + Str(a1.year(3)) + endl
  171. cout = cout + "Ãîä 4 - " + Str(a1.year(4)) + endl
  172. cout = cout + "Ãîä 5 - " + Str(a1.year(5)) + endl
  173. cout = cout + "Ñðåäíÿÿ çîëîòîäîáû÷à - " + Str(a1.average) + endl
  174. cout = cout + "Ìàêñèìàëüíàÿ çîëîòîäîáû÷à - " + Str(a1.max) + endl
  175. cout = cout + "Ãîä ñ ìàêñ. çîëîòîäîáû÷åé - " + Str(a1.maxyear) + endl
  176.  
  177. For i = 1 To 5
  178. summ = summ + a1.year(i)
  179. Next i
  180.  
  181. lbOut.Caption = "Çîëîòîäîáû÷à çà 5 ëåò: " + Str(summ)
  182. TB1.Enabled = False
  183. TB2.Enabled = False
  184. TB3.Enabled = False
  185. TB4.Enabled = False
  186. TB5.Enabled = False
  187. TB6.Enabled = False
  188.  
  189. btnOK.Enabled = False
  190. btnList.Enabled = True
  191. btnInput.Caption = "Äîáàâèòü çàïèñü"
  192. End Sub
  193.  
  194.  
  195.  
  196.  
  197.  
  198. Private Sub lb6_Click()
  199.  
  200. End Sub
  201.  
  202. Private Sub lb8_Click()
  203.  
  204. End Sub
  205.  
  206. Private Sub lb9_Click()
  207.  
  208. End Sub
  209.  
  210. Private Sub LB10_Click()
  211.  
  212. End Sub
  213.  
  214. Private Sub lb11_Click()
  215.  
  216. End Sub
  217.  
  218. Private Sub lb12_Click()
  219.  
  220. End Sub
  221.  
  222. Private Sub lb13_Click()
  223.  
  224. End Sub
  225.  
  226. Private Sub lb14_Click()
  227.  
  228. End Sub
  229.  
  230. Private Sub lb15_Click()
  231.  
  232. End Sub
  233.  
  234. Private Sub lb16_Click()
  235.  
  236. End Sub
  237.  
  238. Private Sub ListBox1_Click()
  239. btnEdit.Enabled = True
  240. btnDelete.Enabled = True
  241. End Sub
  242.  
  243. Private Sub TB1_Change()
  244. a1.countryname = TB1
  245. End Sub
  246.  
  247. Private Sub TB2_Change()
  248. a1.year(1) = Val(TB2)
  249. End Sub
  250.  
  251. Private Sub TB3_Change()
  252. a1.year(2) = Val(TB3)
  253. End Sub
  254.  
  255. Private Sub TB4_Change()
  256. a1.year(3) = Val(TB4)
  257. End Sub
  258.  
  259. Private Sub TB5_Change()
  260. a1.year(4) = Val(TB5)
  261. End Sub
  262.  
  263. Private Sub TB6_Change()
  264. a1.year(5) = Val(TB6)
  265. End Sub
  266.  
  267. Private Sub form_Click()
  268.  
  269. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement