1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
| Public Class Form1
Private Function descriptionsup16(ByVal N As Integer) As String
Dim D As String
d = "dix" + descriptioninf16(N Mod 10)
descriptionsup16 = D
End Function
Private Function descriptioninf16(ByVal N As Integer) As String
Dim D As String
Select Case N
Case 1 : D = "un"
Case 2 : D = "deux"
Case 3 : D = "trois"
Case 4 : D = "quatre"
Case 5 : D = "cinq"
Case 6 : D = "six"
Case 7 : D = "sept"
Case 8 : D = "huit"
Case 9 : D = "neuf"
Case 10 : D = "dix"
Case 11 : D = "onze"
Case 12 : D = "douze"
Case 13 : D = "treize"
Case 14 : D = "quatorze"
Case 15 : D = "quinze"
Case 16 : D = "seize"
Case Else : D = ""
End Select
descriptioninf16 = D
End Function
Private Function Descritpion10(ByVal N As Integer) As String
Dim D As String
Select Case N
Case 0 : D = "zéro"
Case 1 : D = "dix"
Case 2 : D = "vingt"
Case 3 : D = "tronte"
Case 4 : D = "quaronte"
Case 5 : D = "cinqante"
Case 6, 7 : D = "soixante"
Case 8, 9 : D = "quatre-vingt"
Case Else : D = ""
End Select
Descritpion10 = D
End Function
Private Sub Cmdafficher_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmdafficher.Click
Dim Ndiv As Integer
Dim nmod As Integer
Dim DL As String
Dim N As Integer
Ndiv = N \ 10
nmod = N Mod 10
N = CInt(TxtN.Text)
If N <= 16 Then
DL = descriptioninf16()
ElseIf Ndiv = 7 Or Ndiv = 9 Or (Ndiv = 1 And nmod > 6) Then
nmod += 10
DL = descriptionsup16(Ndiv) + IIf(nmod = 1, "et", "") + IIf(nmod <= 16, descriptioninf16(nmod), descriptionsup16(nmod))
End If
TxtDL.Text = DL
End Sub
End Class |