All pastes #804409 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-12-03 13:30 UTC
rendered paste body
        Dim strOrd1, strOrd2, strTemp1, strTemp2 As String
        Dim intLength1, intLength2, idx, intTemp1, intTemp2, intProcent As Integer

        strOrd1 = InputBox("Skriv in ett ord")
        strOrd2 = InputBox("Skriv in ett till ord")

        intLength1 = strOrd1.Length
        intLength2 = strOrd2.Length

        If intLength1 > intLength2 Then
            intTemp2 = intLength1
            intTemp1 = intLength2 - intLength1
        Else
            intTemp2 = intLength2
            intTemp1 = intLength1 - intLength2
        End If


        For idx = 1 To intTemp2
            strTemp1 = Mid(strOrd1, idx, 1)
            strTemp2 = Mid(strOrd2, idx, 1)
            If strTemp1 = strTemp2 Then
                intTemp1 += 1
            Else
                intTemp1 += 0
            End If
        Next

        intProcent = intTemp1 / intTemp2
        intProcent = intProcent * 100
        If intProcent > 80 Then
            MsgBox("Orden är över 80% lika" & intProcent)
        Else
            MsgBox("Orden är inte lika" & intProcent)
        End If
    End Sub