varialogica
Rem funzioni logiche vero And vero TRUE entrambe condizioni vere vero OR vero TRUE se almeno una condizione vera vero NOT vero TRUE se entrambe condizioni vere vero Xor vero TRUE se una vera e una falsa vero EQV vero TRUE se entrambe condizioni vere o false vero IMP vero FALSE solo se prima condizione vera e seconda falsa Private Sub CommandButton1_Click() Dim x As Integer Dim y As Integer x = 10 y = 20 If verifica(x, y) Then Lista.AddItem ("vero " & x * y) Else Lista.AddItem ("falso " & x + y) End If End Sub Public Function verifica(x As Integer, y As Integer) If x > 0 And y > 0 Then verifica = True Else verifica = False End If End Function Public Function verificaOR(x As Integer, y As Integer) If x > 0 Or y > 0 Then verificaOR = True Else verificaOR = False End If End Function Public Function verificaXOR(x As Integer, y As Integer) If x > 0 And y > 0 Then verificaXOR = False Else If x < 0 And y < 0 Then verificaXOR = False Else verificaXOR = True End If End If End Function Public Function verificaEQV(x As Integer, y As Integer) If x > 0 And y > 0 Then verificaEQV = True Else If x < 0 And y < 0 Then verificaEQV = True Else verificaEQV = False End If End If End Function Public Function verificaIMP(x As Integer, y As Integer) If x > 0 And y > 0 Then verificaIMP = True Else If x < 0 And y < 0 Then verificaIMP = True Else If x < 0 And y > 0 Then verificaIMP = True Else If x > 0 And y < 0 Then verificaIMP = False End If End If End If End If End Function Public Function verificaNOT(x As Integer, y As Integer) If x > 0 And Not y < 0 Then verificaNOT = True Else verificaNOT = False End If End Function Private Sub CommandButton10_Click() Dim x As Integer Dim y As Integer x = -10 y = 20 If verificaXOR(x, y) Then Lista.AddItem ("vero " & x * y) Else Lista.AddItem ("falso " & x + y) End If End Sub Private Sub CommandButton11_Click() Dim x As Integer Dim y As Integer x = 10 y = 20 If verificaEQV(x, y) Then Lista.AddItem ("vero " & x * y) Else Lista.AddItem ("falso " & x + y) End If End Sub Private Sub CommandButton12_Click() Dim x As Integer Dim y As Integer x = -10 y = -20 If verificaEQV(x, y) Then Lista.AddItem ("vero " & x * y) Else Lista.AddItem ("falso " & x + y) End If End Sub Private Sub CommandButton13_Click() Dim x As Integer Dim y As Integer x = -10 y = 20 If verificaEQV(x, y) Then Lista.AddItem ("vero " & x * y) Else Lista.AddItem ("falso " & x + y) End If End Sub Private Sub CommandButton15_Click() Dim x As Integer Dim y As Integer x = 10 y = 20 If verificaIMP(x, y) Then Lista.AddItem ("vero " & x * y) Else Lista.AddItem ("falso " & x + y) End If End Sub Private Sub CommandButton16_Click() Dim x As Integer Dim y As Integer x = -10 y = -20 If verificaIMP(x, y) Then Lista.AddItem ("vero " & x * y) Else Lista.AddItem ("falso " & x + y) End If End Sub Private Sub CommandButton17_Click() Dim x As Integer Dim y As Integer x = -10 y = 20 If verificaIMP(x, y) Then Lista.AddItem ("vero " & x * y) Else Lista.AddItem ("falso " & x + y) End If End Sub Private Sub CommandButton18_Click() Dim x As Integer Dim y As Integer x = 10 y = -20 If verificaIMP(x, y) Then Lista.AddItem ("vero " & x * y) Else Lista.AddItem ("falso " & x + y) End If End Sub Private Sub CommandButton2_Click() Dim x As Integer Dim y As Integer x = -10 y = 20 If verifica(x, y) Then Lista.AddItem ("vero " & x * y) Else Lista.AddItem ("falso " & x + y) End If End Sub Private Sub CommandButton3_Click() Dim x As Integer Dim y As Integer x = -10 y = 20 If verificaOR(x, y) Then Lista.AddItem ("vero " & x * y) Else Lista.AddItem ("falso " & x + y) End If End Sub Private Sub CommandButton4_Click() Dim x As Integer Dim y As Integer x = -10 y = -20 If verificaOR(x, y) Then Lista.AddItem ("vero " & x * y) Else Lista.AddItem ("falso " & x + y) End If End Sub Private Sub CommandButton5_Click() Dim x As Integer Dim y As Integer x = 10 y = 20 If verificaNOT(x, y) Then Lista.AddItem ("vero " & x * y) Else Lista.AddItem ("falso " & x + y) End If End Sub Private Sub CommandButton7_Click() Dim x As Integer Dim y As Integer x = -10 y = 20 If verificaNOT(x, y) Then Lista.AddItem ("vero " & x * y) Else Lista.AddItem ("falso " & x + y) End If End Sub Private Sub CommandButton8_Click() Dim x As Integer Dim y As Integer x = 10 y = 20 If verificaXOR(x, y) Then Lista.AddItem ("vero " & x * y) Else Lista.AddItem ("falso " & x + y) End If End Sub Private Sub CommandButton9_Click() Dim x As Integer Dim y As Integer x = -10 y = -20 If verificaXOR(x, y) Then Lista.AddItem ("vero " & x * y) Else Lista.AddItem ("falso " & x + y) End If End Sub