| |
3.8.1.Bitwise operator keywords: bitand, bitor, xor, compl, and_eq, or_eq, xor_eq |
|
#include <iostream>
using std::boolalpha;
using std::cout;
using std::endl;
int main()
{
bool a = true;
bool b = false;
int c = 2;
int d = 3;
cout << boolalpha;
cout << "a = " << a << "; b = " << b
<< "; c = " << c << "; d = " << d;
cout << "\n\nBitwise operator keywords:";
cout << "\nc bitand d: " << ( c bitand d );
cout << "\nc bit_or d: " << ( c bitor d );
cout << "\n c xor d: " << ( c xor d );
cout << "\n compl c: " << ( compl c );
cout << "\nc and_eq d: " << ( c and_eq d );
cout << "\n c or_eq d: " << ( c or_eq d );
cout << "\nc xor_eq d: " << ( c xor_eq d ) << endl;
return 0;
}
|
|
a = true; b = false; c = 2; d = 3
Bitwise operator keywords:
c bitand d: 2
c bit_or d: 3
c xor d: 1
compl c: -3
c and_eq d: 2
c or_eq d: 3
c xor_eq d: 0 |
3.8.bitwise operator | | 3.8.1. | Bitwise operator keywords: bitand, bitor, xor, compl, and_eq, or_eq, xor_eq | | | | 3.8.2. | Bit operator keywords. | | |
|