An expression is composed of one or more operations. The objects of the operations are referred to as operands. An expression in C++ is any valid combination of operators, constants, and variables. |
|
Type of expressions |
|
Arithmetic Expression |
|
Arithmetic expression can either be integer expression or real expression, some times a mixed expression can also be formed with a mixture of real and integer expression. |
|
Integer expression- |
|
int a=10, b=3, c=4, d=213; . a+b, a*d etc |
|
Real expression- |
|
float x=1.20, y=23.63, z=23.23; . x+y, x*z etc. |
|
Logical expression |
|
The expression that result into 0 or 1 are called logical expression. The logical expression are the combination of constants, variable and logical and relational operator. |
|
The following are the examples of valid logical expression: |
|
. x>y, (-y), (x-y) etc. |
|
C++ Escape Sequences |
|
Escape sequences are character constants that are usually used to format text. |
|
Here are the most common: |
|
Common Escape Sequences |
|
\a Bell |
|
\b Backspace |
|
\f Formfeed |
|
\n New Line |
|
\r Carriage Return |
|
\t Horizontal Tab |
|
\v Vertical Tab |
|
\’ Single quote |
|
\” Double quote |
|
\\ Backslash |