你能推算出下列幾個位元運算的結果為何嗎?- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- cout<<(3 | 4)<<endl;
- cout<<(5 & 6)<<endl;
- cout<<(6 ^ 7)<<endl;
- cout<<(2 | 8)<<endl;
- cout<<(7 & 10)<<endl;
- cout<<(9 ^ 10)<<endl;
- return 0;
- }
- /*
- 00000000 0
- 00000001 1
- 00000010 2
- 00000011 3
- 00000100 4
- 00000101 5
- 00000110 6
- 00000111 7
- 00001000 8
- 00001001 9
- 00001010 10
- */
複製代碼 |