Module Module1
Sub Main()
Dim r As Char 'variable pour la fonction Sans-Accent
Dim text, Mot, temp, temp1 As String 'variables de transfert temporaire
Dim Nom(5) As String 'Tableau véritable
Dim Name(5) As String 'Tableau de traitement
'Saisies
For i As Integer = 1 To 5
Console.Write("tapez votre mot N° " & i & " ")
text = Console.ReadLine 'Saisie d'un mot dans la variable de transfert
Nom(i) = text 'Remplir le tableau véritable
Mot = "" 'Vider la variable de transfert
For j As Integer = 1 To Len(text)
r = Sans_Accents(Mid(text, j, 1))
Mot &= r
Next
Name(i) = Mot.ToLower 'Remplir le tableau de traitement
Next
'Tri à bulle
For i As Integer = 1 To 4
For j As Integer = i + 1 To 5
If Name(i) > Name(j) Then 'Traitement
temp1 = Name(i) 'Swap sur le tablau de traitement
Name(i) = Name(j)
Name(j) = temp1
temp = Nom(i) 'Swap sur le tableau véritable
Nom(i) = Nom(j)
Nom(j) = temp
End If
Next
Next
'Affichage
Console.WriteLine()
For i As Integer = 1 To 5
Console.WriteLine(Nom(i))
Next
Console.ReadLine()
End Sub
Function Sans_Accents(ByVal Lt As Char) As Char
Dim Res As Char
Select Case Lt
Case "à", "â", "ä"
Res = "a"
Case "é", "è", "ê", "ë"
Res = "e"
Case "î", "ï"
Res = "i"
Case "ô", "ö"
Res = "o"
Case "ù", "û", "ü"
Res = "u"
Case "ÿ"
Res = "y"
Case "ç"
Res = "c"
Case Else
Return Lt 'Retourne les caractères non mentionnés
End Select
Return Res 'Retourne les caractères mentionnés
End Function
End Module