*每天学习c++一小时*-expressions, operations and statements

每天学习c++一小时-expressions, operations and statements

1.using count to display on the screen with semicolon “;” ending

2.whitespace is not visible to the compiler, but whitespace with string literals makes difference

3.inserting backslash() at the end to spread a statement over two lines

4.prefix ++number L-value is the incremented value VS postfix number++ L-value is the original number

5.NOT ! AND && OR ||

6.1000>>1 =0100 1000>>2 =00100
1000<<1 =10000 1000<<2 =100000

7.bitset<8> inputBits(number) means transforming number into 2-Bits

8.bitset<8> bitwiseNOT = (~inputNum);
bitset<8> bitwiseAND = (0x0F & inputNum);// 0x0F is hex for 0001111
bitset<8> bitwiseOR = (0x0F | inputNum);
~10110101 = 01001010
Logical AND, & with 00001111
0001111 & 10110101 = 00000101
Logical OR, | with 00001111
00001111 | 10110101 = 10111111
Logical XOR, ^ with 00001111
00001111 ^ 10110101 = 10111010

9.the result of shifting signed numbers is implementation dependent. On some compilers, most-significant-bit when shifted left is not assigned to the least-significant-bit; rather the latter is zero.

发布了2 篇原创文章 · 获赞 0 · 访问量 27

猜你喜欢

转载自blog.csdn.net/weixin_42640552/article/details/103952013