Advertisement
kqlul123

Untitled

Apr 1st, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. Dim arr() As Integer
  2. Dim newarr() As Integer
  3. Dim n As Integer
  4. Dim a As Integer
  5. Dim cout As String
  6. Dim endl As String
  7. Dim b As Integer
  8. Dim count As Integer
  9. Dim cout2 As String
  10.  
  11.  
  12.  
  13. Private Sub cmd1_Click()
  14.  
  15. End Sub
  16.  
  17. Private Sub cmd2_Click()
  18. n = Val(InputBox("Ââåäèòå êîë-âî ýëåìåíòîâ"))
  19. a = Val(InputBox("Ââåäèòå à"))
  20. b = Val(InputBox("Ââåäèòå á"))
  21. endl = Chr(13) + Chr(10)
  22. ReDim arr(n)
  23. ReDim newarr(n)
  24. For i = 1 To n
  25. arr(i) = Int((b - a + 1) * Rnd + a)
  26. Next i
  27. count = 0
  28. For i = 1 To n
  29. If i Mod 2 = 1 Then newarr(i + count) = arr(i) Else newarr(i + count) = 0: count = count + 1
  30. ReDim Preserve newarr(n + count)
  31. Next i
  32. For i = 1 To n
  33. cout = cout + "Ýëåìåíò " + Str(i) + ":" + Str(arr(i)) + endl
  34. Next i
  35.  
  36. For i = 1 To n + count
  37. cout2 = cout2 + "Ýëåìåíò " + Str(i) + ":" + Str(newarr(i)) + endl
  38. Next i
  39.  
  40. TB2.MultiLine = True
  41. TB1.MultiLine = True
  42. TB1.Text = cout2
  43. TB2.Text = cout
  44. End Sub
  45.  
  46.  
  47.  
  48. Private Sub cmdExit_Click()
  49. End
  50. End Sub
  51.  
  52. Private Sub TB2_Change()
  53.  
  54. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement