CHAR |
DEC |
HEX |
CHAR |
DEC |
HEX |
CHAR |
DEC |
HEX |
CHAR |
DEC |
HEX |
|||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
[NUL] |
0 |
00 |
32 |
20 |
@ |
64 |
40 |
` |
96 |
60 |
||||
[SOH] |
1 |
01 |
! |
33 |
21 |
A |
65 |
41 |
a |
97 |
61 |
|||
[STX] |
2 |
02 |
" |
34 |
22 |
B |
66 |
42 |
b |
98 |
62 |
|||
[ETX] |
3 |
03 |
# |
35 |
23 |
C |
67 |
43 |
c |
99 |
63 |
|||
[EOT] |
4 |
04 |
$ |
36 |
24 |
D |
68 |
44 |
d |
100 |
64 |
|||
[ENQ] |
5 |
05 |
% |
37 |
25 |
E |
69 |
45 |
e |
101 |
65 |
|||
[ACK] |
6 |
06 |
& |
38 |
26 |
F |
70 |
46 |
f |
102 |
66 |
|||
[BEL] |
7 |
07 |
' |
39 |
27 |
G |
71 |
47 |
g |
103 |
67 |
|||
[BS] |
8 |
08 |
( |
40 |
28 |
H |
72 |
48 |
h |
104 |
68 |
|||
[HT] |
9 |
09 |
) |
41 |
29 |
I |
73 |
49 |
i |
105 |
69 |
|||
[LF] |
10 |
0A |
* |
42 |
2A |
J |
74 |
4A |
j |
106 |
6A |
|||
[VT] |
11 |
0B |
+ |
43 |
2B |
K |
75 |
4B |
k |
107 |
6B |
|||
[FF] |
12 |
0C |
, |
44 |
2C |
L |
76 |
4C |
l |
108 |
6C |
|||
[CR] |
13 |
0D |
- |
45 |
2D |
M |
77 |
4D |
m |
109 |
6D |
|||
[SO] |
14 |
0E |
. |
46 |
2E |
N |
78 |
4E |
n |
110 |
6E |
|||
[SI] |
15 |
0F |
/ |
47 |
2F |
O |
79 |
4F |
o |
111 |
6F |
|||
[DLE] |
16 |
10 |
0 |
48 |
30 |
P |
80 |
50 |
p |
112 |
70 |
|||
[DC1] |
17 |
11 |
1 |
49 |
31 |
Q |
81 |
51 |
q |
113 |
71 |
|||
[DC2] |
18 |
12 |
2 |
50 |
32 |
R |
82 |
52 |
r |
114 |
72 |
|||
[DC3] |
19 |
13 |
3 |
51 |
33 |
S |
83 |
53 |
s |
115 |
73 |
|||
[DC4] |
20 |
14 |
4 |
52 |
34 |
T |
84 |
54 |
t |
116 |
74 |
|||
[NAK] |
21 |
15 |
5 |
53 |
35 |
U |
85 |
55 |
u |
117 |
75 |
|||
[SYN] |
22 |
16 |
6 |
54 |
36 |
V |
86 |
56 |
v |
118 |
76 |
|||
[ETB] |
23 |
17 |
7 |
55 |
37 |
W |
87 |
57 |
w |
119 |
77 |
|||
[CAN] |
24 |
18 |
8 |
56 |
38 |
X |
88 |
58 |
x |
120 |
78 |
|||
[EM] |
25 |
19 |
9 |
57 |
39 |
Y |
89 |
59 |
y |
121 |
79 |
|||
[SUB] |
26 |
1A |
: |
58 |
3A |
Z |
90 |
5A |
z |
122 |
7A |
|||
[ESC] |
27 |
1B |
; |
59 |
3B |
[ |
91 |
5B |
{ |
123 |
7B |
|||
[FS] |
28 |
1C |
< |
60 |
3C |
\ |
92 |
5C |
| |
124 |
7C |
|||
[GS] |
29 |
1D |
= |
61 |
3D |
] |
93 |
5D |
} |
125 |
7D |
|||
[RS] |
30 |
1E |
> |
62 |
3E |
^ |
94 |
5E |
~ |
126 |
7E |
|||
[US] |
31 |
1F |
? |
63 |
3F |
_ |
95 |
5F |
[DEL] |
127 |
7F |
and |
double |
not |
this |
and_eq |
dynamic_cast |
not_eq |
throw |
asm |
else |
operator |
true |
auto |
enum |
or |
try |
bitand |
explicit |
or_eq |
typedef |
bitor |
export |
private |
typeid |
bool |
extern |
protected |
typename |
break |
false |
public |
union |
case |
float |
register |
unsigned |
catch |
for |
reinterpret_cast |
using |
char |
friend |
return |
virtual |
class |
goto |
short |
void |
compl |
if |
signed |
volatile |
const |
inline |
sizeof |
wchar_t |
const_cast |
int |
static |
while |
continue |
long |
static_cast |
xor |
default |
mutable |
struct |
xor_eq |
delete |
namespace |
switch |
|
do |
new |
template |
In the 1998 ANSI/ISO C++ standard
alignas |
char32_t |
final |
override |
alignof |
constexpr |
noexcept |
static_assert |
char16_t |
decltype |
nullptr |
thread_local |
Additional keywords added by the C++11 standard
Description |
ASCII character |
Escape sequence |
---|---|---|
audible bell (alert) |
BEL |
'\a' |
backspace |
BS |
'\b' |
form feed – new page |
FF |
'\f' |
line feed - new line |
NL (LF) |
'\n' |
carriage return |
CR |
'\r' |
horizontal tab |
HT |
'\t' |
vertical tab |
VT |
'\v' |
single quote |
' |
'\'' |
double quote |
" |
'\"' |
backslash |
\ |
'\\' |
question mark |
? |
'\?' |
ANSI character with an octal code |
ooo |
'\ooo' |
Null character |
NUL |
'\0' |
ANSI character with a hexadecimal code |
hh |
'\xhh' |
16-bit Unicode character |
hhhh |
'\uhhhh' |
32-bit Unicode character |
hhhhhhhh |
'\Uhhhhhhhh' |
Data type |
Range of values |
Size (bytes) |
Precision (digits) |
---|---|---|---|
bool |
false, true |
1 |
|
char |
-128..127 |
1 |
|
signed char |
-128..127 |
1 |
|
unsigned char |
0..255 |
1 |
|
wchar_t |
0..65535 |
2 |
|
int |
-2147483648..2147483647 |
4 |
|
unsigned int |
0..4294967295 |
4 |
|
short |
-32768..32767 |
2 |
|
unsigned short |
0..65535 |
2 |
|
long |
-2147483648..2147483647 |
4 |
|
unsigned long |
0..4294967295 |
4 |
|
long long |
-9223372036854775808.. 9223372036854775807 |
8 |
|
unsigned long long |
0..18446744073709551615 |
8 |
|
float |
3.4E-38..3.8E+38 |
4 |
6 |
double |
1.7E-308..1.7E+308 |
8 |
15 |
long double |
3.4E-4932..3.4E+4932 |
10 |
19 |
Category |
C++ statements |
---|---|
Declaration/definition statements |
types (class, struct, union, enum, typedef), functions, objects |
Expression statements |
expression; |
Empty statement |
; |
Compound statement |
{ statements } |
Selection statements |
if, else,switch, case |
Iteration statements |
do, for, while |
Flow control statements |
break, continue, default, goto, return |
Exception handling statements |
throw, try-catch |
Category |
Directive |
---|---|
Conditional directive |
#ifdef, #ifndef, #if, #endif, #else, #elif |
Defining symbols/macros |
#define |
Undefining symbols/macros |
#undef |
Including source files |
#include |
Generating compilation errors |
#error |
Modifying the line number (and file name) in compilation messages |
#line |
Implementation dependent control of the compilation process |
#pragma |
Predefined macros
Macro |
Description |
---|---|
|
String containing the date of the compilation. |
|
String containing the time of the compilation. |
|
String containing the name of the source file. |
|
A numeric constant containing the actual line number of the source file (numbering starts from 1). |
|
Its value is 1 if the compiler works as an ANSI C++ compiler, otherwise it is not defined. |
|
Its value is 1, if in a C++ source file, otherwise it is not defined. |
|
Its value is 1, if in a C++/CLI source file, otherwise it is not defined. |
Precedence |
Operator |
Name or meaning |
Associativity |
---|---|---|---|
1. |
:: |
scope resolution |
none |
2. |
( ) |
function call, member initialization |
from left to right |
[ ] |
array indexing |
||
-> |
indirect member selection (pointer) |
||
. |
direct member selection (object) |
||
++ |
(postfix) increment |
||
-- |
(postfix) decrement |
||
type () |
type-cast (conversion) |
||
dynamic_cast |
checked type-cast at runtime (conversion) |
||
static_cast |
checked type-cast during compilation time (conversion) |
||
reinterpret_cast |
unchecked type-cast (conversion) |
||
const_cast |
constant type-cast (conversion) |
||
typeid |
type identification |
||
3. |
! |
logical negation (NOT) |
from right to left |
~ |
bitwise negation |
||
+ |
+ sign (numbers) |
||
- |
- sign (numbers) |
||
++ |
(prefix) increment |
||
-- |
(prefix) decrement |
||
& |
address-of operator |
||
* |
indirection operator |
||
( type ) |
type-cast (conversion) |
||
sizeof |
size of an object/type in bytes |
||
new |
allocating dynamic memory space |
||
delete |
deallocating dynamic memory space |
||
4. |
.* |
direct reference to a class member |
from left to right |
->* |
indirect reference to a member of the object the pointer points to |
||
5. |
* |
multiplication |
from left to right |
/ |
division |
||
% |
modulo |
||
6. |
+ |
addition |
from left to right |
– |
subtraction |
||
7. |
<< |
bitwise left shift |
from left to right |
>> |
bitwise right shift |
||
8. |
< |
less than |
from left to right |
<= |
less than or equals |
||
> |
greater than |
||
>= |
greater than or equals |
||
9. |
== |
equal to |
from left to right |
!= |
not equal to |
||
10. |
& |
bitwise AND |
from left to right |
11. |
| |
bitwise inclusive OR |
from left to right |
12. |
^ |
bitwise exclusive OR (XOR) |
from left to right |
13. |
&& |
logical AND |
from left to right |
14. |
|| |
logical OR |
from left to right |
15. |
expr ? expr : expr |
conditional expression |
from right to left |
16. |
= |
simple value assignment |
from right to left |
*= |
multiplication assignment |
||
/= |
division assignment |
||
%= |
modulo assignment |
||
+= |
addition assignment |
||
-= |
subtraction assignment |
||
<<= |
bitwise left shift assignment |
||
>>= |
bitwise right shift t assignment |
||
&= |
bitwise AND assignment |
||
^= |
bitwise XOR assignment |
||
|= |
bitwise OR assignment |
||
17. |
throw expr |
throwing an expression |
from right to left |
18. |
expr , expr |
operation sequence (comma operator) |
from left to right |
Usage |
Type |
Function |
Include file |
---|---|---|---|
calculation of absolute value |
real |
|
|
calculation of absolute value |
integer |
|
|
cosine of an angle (in radians) |
real |
|
|
sine of an angle (in radians) |
real |
|
|
tangent of an angle (in radians) |
real |
|
|
the inverse cosine of the argument (in radians) |
real |
|
|
the inverse sine of the argument (in radians) |
real |
|
|
the inverse tangent of the argument (in radians) |
real |
|
|
the inverse tangent of y/x (in radians) |
real |
|
|
natural logarithm |
real |
|
|
base 10 logarithm |
real |
|
|
ex |
real |
|
|
power (xy) |
real |
|
|
square root |
real |
|
|
random number between 0 and RAND_MAX |
real |
|
|
the value of π |
real |
|
|
Where the type real designates one of the following types: float, double or long double. The type integer designates one of the int or long types
Properties |
Result |
|||
---|---|---|---|---|
Scope |
Item |
Storage class |
Lifetime |
Visibility |
file-level |
variable definition |
|
global |
restricted to a given file, from its definition to the end of the file |
variable declaration |
|
global |
from its definition to the end of the file |
|
prototype or function definition |
|
global |
restricted to the given file |
|
function prototype |
|
global |
from its definition to the end of the file |
|
block-level |
variable declaration |
|
global |
block |
variable definition |
|
global |
block |
|
variable definition |
|
local |
block |
|
variable definition |
|
local |
block |
Parameterless manipulators <iostream>
The following manipulators are used in pairs, they have their effects from the time they are set until they are unset:
Manipulator |
Stream |
Description (when they are set) |
---|---|---|
|
I/O |
The logical values can be provided with the keywords true and false. |
|
O |
The sign of the numeral system is also printed out before numbers (0 or 0x). |
|
O |
Decimal point is always printed. |
|
O |
A plus sign always printed out for any number that is not negative. |
|
I |
Discarding whitespace characters. |
|
O |
Flushing the buffer automatically after each operation. |
|
O |
When numbers are printed out, (e and x) will always be uppercase |
Some manipulators modifying data streams:
Manipulator |
Stream |
Description |
---|---|---|
|
O |
Insert newline and flush. |
|
O |
Insert null character. |
|
O |
Flush the stream buffer. |
|
I |
Extract whitespaces. |
The effects of the following manipulators can be modified by those provided in the same group:
Manipulator |
Stream |
Description |
---|---|---|
Alignment |
||
|
O |
Left-aligned |
|
O |
Right-aligned - default |
|
O |
The output is padded to the field as best as possible by inserting filler characters |
Numeral system |
||
|
I/O |
Decimal - default |
|
I/O |
Hexadecimal |
|
I/O |
Octal |
Printing out real numbers (if these manipulator flags are not set, the compiler decides their format) |
||
|
O |
Fixed-point notation |
|
O |
Scientific notation |
Parameterized manipulators <iomanip>:
setw affects only the data element that immediately follows him, and the others affect all subsequent data elements for the output stream.
Manipulator |
Stream |
Description |
---|---|---|
|
O |
Set fill character. |
|
O |
Set decimal precision. |
|
O |
Set field width. |
|
O |
Sets the numeric base field (8,10,16). |
C++ language library |
|
Types (NULL, size_t etc.) |
<cstddef> |
Limits of different types |
<limits>, <climits>, <cfloat> |
Program control |
<cstdlib> |
Dynamic memory handling |
<new> |
Type identification |
<typeinfo>, <typeindex>, <type_traits> |
Exception handling types |
<exception> |
Other run-time support |
<cstdarg>, <csetjmp>, <ctime>, <csignal>, <cstdlib>,<cstdbool>, <cstdalign> |
Diagnostic library |
|
Exception classes |
<stdexcept> |
Assert macros |
<cassert> |
Error codes |
<cerrno> |
System error support |
<system_error> |
Library of general services |
|
Function elements (STL) |
<utility> |
Function objects (STL) |
<functional> |
High level memory handling (STL) |
<memory>, <scoped_allocator> |
Special class templates (STL) |
<bitset>, <tuple> |
Date and time handling |
<ctime> , <chrono> |
String library |
|
String classes |
<string> |
C-style string handling |
<cctype>, <cwctype>, <cstring>, <cwchar>, <cstdlib>, <cuchar> |
Library of country-specific (local) settings |
|
Localization utilities |
<locale> |
C localization utilities |
<clocale> |
Unicode conversion facilities |
<codecvt> |
Library of containers (STL) |
|
Sequential containers (STL) |
<array>, <deque>, <list>, <vector>, <forward_list> |
Associative containers (STL) |
<map>, <set> |
Unordered associative containers(STL) |
<unordered _map>, <unordered_set> |
Container adaptors (STL) |
<queue>, <stack> |
Library of iterators (generic pointers) (STL) |
|
Iterator elements, predefined iterators, data stream iterators (STL) |
<iterator> |
Algorithms library |
|
Algorithms that operate on containers (STL) |
<algorithm> |
Algorithms of the C library |
<cstdlib> |
Numeric library |
|
Complex number type |
<complex> |
Representing and manipulating arrays of values |
<valarray> |
Numeric operations on values in containers |
<numeric> |
The numeric elements of the C library |
<cmath>, <cstdlib>, <ctgmath> |
Compile-time rational arithmetic |
<ratio> |
Random number generators and distributions |
<random> |
Floating-point environment access functions |
<cfenv> |
Standard Input/Output library |
|
Forward declarations of all I/O classes |
<iosfwd> |
Standard iostream objects |
<iostream> |
The base class of the iostream classes |
<ios> |
Data stream buffers |
<streambuf> |
Data formatting and manipulators |
<istream>, <ostream>, <iomanip> |
String data streams |
<sstream> |
File data streams |
<fstream>, <cstdio>, <cinttypes> |
Regular expressions library |
|
Regular expression processing. |
<regex> |
Functions for concurrent programming |
|
Atomic types and operations |
<atomic> |
Thread support library |
|
Creating and controlling threads |
<thread>, <mutex>, <condition_variable>, <future> |
The underscored names are the header files of the C++11 standard.