cout << boolalpha into the printout 0 false, 1 into true
Logical Operators:
&& (AND) and two conditions are true when the result is true
|| (or), or when two conditions are true is true
! Non-inverted
Bit operators (binary):
& Bitwise compared with the same 1 1
| Bitwise or there was a 1 1
~ Bitwise inverted (negated 8), is converted into a negative binary 10 hex: binary negated, + 1, then take a negative
^ Bitwise XOR 0 is the same; different 1
<< 0 cases left right gap fill: 2 << 3 10 binary ----> 10000 16-bit result
>> shift right sign bits fill the vacancy left
sizeof operator used to obtain the size of the memory space occupied by the data type
Usage: sizeof (type_name)
Results bits in byte units
Operator precedence:
Three operators:
int num = 5> 6? 10: 12;
5 is greater than 6, otherwise it returns 10 12
if the structure:
{
else
{
Example:
// use the program to determine whether the character entered by the user is legitimate hard disk drive char PAN = ' \ 0 ' ; // default value is set to null character cout << " Please enter a character, I judge the legality of \ the n- " ; CIN >> PAN; // 'A' ~ 'the Z' IF (PAN> = ' A ' && PAN <= ' the Z ' ) // 'A' may also be a 65 (ascii code) { COUT << " legitimate letter " << endl; } The else { COUT << " illegal letter" << endl; } system("pause");
1