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
| Module Module1
Dim tablo() As Employer
Public Structure ddn
Public jour As Integer
Public mois As String
Public annnee As Integer
End Structure
Public Structure Employer
Public nom As String
Public salaire As Double
Public sadate As ddn
Public Sub New(ByVal nnom As String, ByVal ssalaire As Double, ByVal jjour As Integer, ByVal mmois As String, ByVal aannee As Integer)
Me.nom = nnom
salaire = ssalaire
sadate.jour = jjour
sadate.mois = mmois
sadate.annnee = aannee
End Sub
End Structure
Sub Main()
Dim p1 As New Employer("Sarah", 7500, 28, "mars", 1979)
ReDim Preserve tablo(0)
tablo(0) = p1
Dim p2 As New Employer("Nadine", 55000, 17, "fevrier", 1983)
ReDim Preserve tablo(1)
tablo(1) = p2
Dim p3 As New Employer("kamal", 54500, 20, "avril", 1980)
ReDim Preserve tablo(2)
tablo(2) = p3
Dim p4 As New Employer("Jacques", 56000, 2, "juin", 1985)
ReDim Preserve tablo(3)
tablo(3) = p4
affiche(tablo)
Console.ReadKey()
End Sub
Public Sub affiche(ByVal ttablo() As Employer)
For i As Integer = 0 To ttablo.Length - 1
Console.WriteLine("votre nom est: " & ttablo(i).nom & " et vous gagnez: " & ttablo(i).salaire & " Dh.")
Console.WriteLine("vous etes ne (e) le " & ttablo(i).sadate.jour & " " & ttablo(i).sadate.mois & " " & ttablo(i).sadate.annnee)
Console.WriteLine("===========================================")
Next
End Sub
End Module |
Partager