是输入。需要放0,1,x或x̅:
x & 0 = 0
x & 1 = x
x | 0 = x
x | 1 = 0
x ^ 0 = 1
x ^ 1 =
答案 0 :(得分:1)
如果x
是布尔值,那么!x
是x的布尔否定。这是你的'翻转'。
要开启和关闭,只需执行x = 1
和x = 0
答案 1 :(得分:1)
x & 0 = 0
x & 1 = x
x | 0 = x
x | 1 = 1
x ^ 0 = x
x ^ 1 = 0 if x is 1, 1 if x is 0