Advertisement
kqlul123

РОФЛЫ ПОЖИЛОГО

Mar 29th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. Option Explicit
  2. Dim rq As String
  3. Dim endl As String
  4. Dim IStr As String
  5. Dim maxLength As Integer
  6. Dim word As Variant
  7. Dim i As Integer
  8. Dim maxword As String
  9. Dim cout As String
  10.  
  11. Private Sub btnExit_Click()
  12. End
  13. End Sub
  14.  
  15. Private Sub btnInput_Click()
  16. tbString.MultiLine = True
  17. IStr = InputBox("Введите строку")
  18. tbString.Text = "Введенная строка:" + endl + IStr
  19. End Sub
  20.  
  21. Public Sub btnReq_Click()
  22. tbRq.MultiLine = True
  23. endl = Chr(13) + Chr(10)
  24. rq = "Дана строка, в которой слова отделены одним или несколькими пробелами" + endl
  25. rq = rq + "Найти слово максимальной длины и вывести его, изменив порядок символов в нем на обратный"
  26. tbRq.Text = rq
  27. End Sub
  28.  
  29. Private Sub btnSolution_Click()
  30. maxLength = 0
  31. If Len(IStr) = 0 Then Exit Sub
  32.  
  33.  
  34. For Each word In Split(IStr)
  35. i = Len(word)
  36. If i > maxLength Then maxLength = i: maxword = word
  37. Next word
  38.  
  39.  
  40. cout = "Слово максимальной длины: " + StrReverse(maxword) + endl
  41. cout = cout + "Его длина: " + str(maxLength)
  42. MsgBox (cout)
  43.  
  44.  
  45.  
  46.  
  47. End Sub
  48.  
  49. Private Sub tbRq_Change()
  50. End Sub
  51.  
  52. Private Sub tbString_Change()
  53. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement