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
| Option Explicit
Sub saisieTableau(ByRef tableau() As Integer, ByRef dimension As Integer)
Dim i As Integer
Dim temp As Integer
dimension = InputBox("Entrer la dimension du tableau <50: ")
Do While dimension < 1 Or dimension > 50
dimension = InputBox("Erreur, la valeur doit être comprise entre 1 et 50. Entrez une nouvelle valeur : ")
Loop
i = 0
Do
temp = InputBox("Saisir la valeur numéro " & i + 1 & " du tableau : ")
tableau(i) = temp
i = i + 1
Loop While i < dimension
End Sub
Sub afficheTableau(ByRef tableau() As Integer, ByRef dimension As Integer)
Dim i As Integer
Dim affichage As Integer
For i = 0 To dimension - 1
affichage = MsgBox(tableau(i), , "")
Next i
End Sub
Sub testExo4TD1()
Dim tableau(50) As Integer
Dim dimension As Integer
Call saisieTableau(tableau(), dimension)
Call afficheTableau(tableau(), dimension)
End Sub |
Partager