Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not...

56

Transcript of Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not...

Page 2: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0
Page 4: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0
Page 5: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0
Page 6: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

https://media.lanecc.edu/users/birdb/CS133G/CodeBlocks%20Troubleshooting.html

Page 7: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0
Page 8: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0
Page 10: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0
Page 11: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0
Page 12: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

==, !=, >, <, >=, <=

(a > 7) , (b % 2 == 0), (x <= w)

!, &&, ||

(a > 7) && (b % 2 == 0)

!(x >= 7) || (a == 0)

Page 13: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

int

=

+

-

*

/

%

==

!=

<

>

<=

>=

Page 14: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

int

=

+

-

*

/

%

==

!=

<

>

<=

>=

Page 15: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

==, !=, >, <, >=, <=

(a > 7) , (b % 2 == 0), (x <= w)

!, &&, ||

(a > 7) && (b % 2 == 0)

!(x >= 7) || (a == 0)

Page 16: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

!

< > <= >=

== !=

&&

||

• x > 0 || y == 3 && !z

• (x > 0) || ((y == 3) && (!z))

Page 17: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

&& ||

• (a && b) == (b && a)

• (a || b) == (b || a)

!!a == a

Page 18: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

! && ||

Page 19: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

!A A

negazione

(NOT)

A !A

0 1

1 0

Page 20: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

A && B A B

congiunzione

(AND)

A B A && B

0 0 0

0 1 0

1 0 0

1 1 1

Page 21: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

A && B A B

congiunzione

(AND)

A B A && B

0 0 0

0 1 0

1 0 0

1 1 1

Page 22: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

A || B

disgiunzione

(OR)

A B A || B

0 0 0

0 1 1

1 0 1

1 1 1

Page 23: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

A || B

disgiunzione

(OR)

A B A || B

0 0 0

0 1 1

1 0 1

1 1 1

Page 24: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

A xnor B = not((A and (not B)) or (B and (not A)))

A xor B = ( A and ( not B ) ) or ( ( not A ) and B )

Page 25: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

𝑛 → 2𝑛 2𝑛

Page 26: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

A && !B || C

Page 27: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

A && !B || C

A B C !B A && !B A && !B || C

0 0 0 1 0 0

0 0 1 1 0 1

0 1 0 0 0 0

0 1 1 0 0 1

1 0 0 1 1 1

1 0 1 1 1 1

1 1 0 0 0 0

1 1 1 0 0 1

Page 28: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

A && !B || C

A B C !B A && !B A && !B || C

0 0 0

0 0 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

Page 29: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

A && !B || C

A B C !B A && !B A && !B || C

0 0 0 1

0 0 1 1

0 1 0 0

0 1 1 0

1 0 0 1

1 0 1 1

1 1 0 0

1 1 1 0

Page 30: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

A && !B || C

A B C !B A && !B A && !B || C

0 0 0 1 0

0 0 1 1 0

0 1 0 0 0

0 1 1 0 0

1 0 0 1 1

1 0 1 1 1

1 1 0 0 0

1 1 1 0 0

Page 31: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

A && !B || C

A B C !B A && !B A && !B || C

0 0 0 1 0 0

0 0 1 1 0 1

0 1 0 0 0 0

0 1 1 0 0 1

1 0 0 1 1 1

1 0 1 1 1 1

1 1 0 0 0 0

1 1 1 0 0 1

Page 32: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

A and B or not C

A B C X = A and B Y = not C X or Y

0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1

0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0

0 1 0 0 and 1 = 0 not 0 = 1 0 or 1 = 1

0 1 1 0 and 1 = 0 not 1 = 0 0 or 0 = 0

1 0 0 1 and 0 = 0 not 0 = 1 0 or 1 = 1

1 0 1 1 and 0 = 0 not 1 = 0 0 or 0 = 0

1 1 0 1 and 1 = 1 not 0 = 1 1 or 1 = 1

1 1 1 1 and 1 = 1 not 1 = 0 1 or 0 = 1

Page 33: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0
Page 34: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

∃𝑥 | 𝑥2 1

𝑥 ∈ ℕ, ∃𝑎, 𝑏, 𝑐, 𝑑 ∈ ℕ | 𝑥 𝑎2𝑏2𝑐2𝑑2

Page 35: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0
Page 36: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

A && (!B || C)

Page 37: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

A && (!B || C)

A B C !B !B || C A && (!B||C)

0 0 0

0 0 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

Page 38: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

|| &&

1. !(a && b) == !a || !b

2. !(a || b) == !a && !b

!((a >= 5) && (a <= 10)) ->

!(a >= 5)||!(a <= 10) >= <=

!!(a < 5)|| !!(a > 10)

((a < 5) || (a > 10))

Page 39: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

• A || C && !B

• !((B || !C) && !A)

!((B || !C) && !A)

(!(B || !C) || !!A)

!(B || !C) || A

(!B && C) || A

A || (!B && C)

A || (C && !B)

A || C && !B

Page 40: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

• A || C && !B

• !((B || !C) && !A)

Page 41: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

• A || C && !B

• !((B || !C) && !A)

!((B || !C) && !A)

(!(B || !C) || !!A)

!(B || !C) || A

(!B && C) || A

A || (!B && C)

A || (C && !B)

A || C && !B

Page 42: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

• A || C && !B

• !((B || !C) && !A)

!((B || !C) && !A)

(!(B || !C) || !!A)

!(B || !C) || A

(!B && C) || A

A || (!B && C)

A || (C && !B)

A || C && !B

Page 43: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

• A || C && !B

• !((B || !C) && !A)

!((B || !C) && !A)

(!(B || !C) || !!A)

!(B || !C) || A

(!B && C) || A

A || (!B && C)

A || (C && !B)

A || C && !B

Page 44: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

• A || C && !B

• !((B || !C) && !A)

!((B || !C) && !A)

(!(B || !C) || !!A)

!(B || !C) || A

(!B && C) || A

A || (!B && C)

A || (C && !B)

A || C && !B

Page 45: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

• A || C && !B

• !((B || !C) && !A)

!((B || !C) && !A)

(!(B || !C) || !!A)

!(B || !C) || A

(!B && C) || A

A || (!B && C)

A || (C && !B)

A || C && !B

Page 46: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

• A || C && !B

• !((B || !C) && !A)

!((B || !C) && !A)

(!(B || !C) || !!A)

!(B || !C) || A

(!B && C) || A

A || (!B && C)

A || (C && !B)

A || C && !B

Page 47: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

• A || C && !B

• !((B || !C) && !A)

!((B || !C) && !A)

(!(B || !C) || !!A)

!(B || !C) || A

(!B && C) || A

A || (!B && C)

A || (C && !B)

A || C && !B

Page 48: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0
Page 49: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0
Page 50: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

if switch

while do while for

Page 51: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

• 0

!=0

if

while

Page 52: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0
Page 53: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

==, !=, <, >, <=, >=

Page 54: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

X == 0

X > 0 && A != 3

!( (x+5)*10 >= ALFA3 / (Beta_Due+1) )

! a || b && c

prima !, poi &&, poi ||

Page 55: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

&& ||

( x != 0 ) && ( (100 / x) == 0 )

Page 56: Informatica B Boracchi · A and B or not C A B C X = A and B Y = not C X or Y 0 0 0 0 and 0 = 0 not 0 = 1 0 or 1 = 1 0 0 1 0 and 0 = 0 not 1 = 0 0 or 0 = 0 0 1 0 0 and 1 = 0 not 0

int a = 0, b = 4;

a = b;

printf( "%d", a );

int a = 0, b = 4;

if ( a == b )

printf( "uguali" );

else

printf( "diversi" );