Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Option Explicit
- Dim rq As String
- Dim endl As String
- Dim IStr As String
- Dim maxLength As Integer
- Dim word As Variant
- Dim i As Integer
- Dim maxword As String
- Dim cout As String
- Private Sub btnExit_Click()
- End
- End Sub
- Private Sub btnInput_Click()
- tbString.MultiLine = True
- IStr = InputBox("Введите строку")
- tbString.Text = "Введенная строка:" + endl + IStr
- End Sub
- Public Sub btnReq_Click()
- tbRq.MultiLine = True
- endl = Chr(13) + Chr(10)
- rq = "Дана строка, в которой слова отделены одним или несколькими пробелами" + endl
- rq = rq + "Найти слово максимальной длины и вывести его, изменив порядок символов в нем на обратный"
- tbRq.Text = rq
- End Sub
- Private Sub btnSolution_Click()
- maxLength = 0
- If Len(IStr) = 0 Then Exit Sub
- For Each word In Split(IStr)
- i = Len(word)
- If i > maxLength Then maxLength = i: maxword = word
- Next word
- cout = "Слово максимальной длины: " + StrReverse(maxword) + endl
- cout = cout + "Его длина: " + str(maxLength)
- MsgBox (cout)
- End Sub
- Private Sub tbRq_Change()
- End Sub
- Private Sub tbString_Change()
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement