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
| Option Explicit
'nombre complexe
Private Type complex
real As Double ' partie réelle
img As Double 'partie imaginaire
End Type
Sub test()
Dim z1, z2, z3 As complex
Dim x, y As Double
z1.real = 1
z1.img = -1
z2.real = 2
z2.img = 0
z3 = add(z1, z2)
MsgBox z3.real 'ça beug ici,il dit argument z1 incompatible avec byref
MsgBox z3.img
End Sub
Public Function add(z1 As complex, z2 As complex) As complex
Dim x1, x2, y1, y2 As Double
x1 = z1.real
x2 = z2.img
y1 = z1.real
y2 = z2.img
add.real = x1 + x2
add.img = y1 + y2
End Function |