Professional Documents
Culture Documents
(C++) Lec 2 Basic Elements of C++
(C++) Lec 2 Basic Elements of C++
Lecture 2
C++
Basic C++ Data types
FYI
char Data Type
Sequence of characters
bool type
Two values such as: true and false , 0 and 1, yes
and no.
1. Arithmetic Operators
2. Comparison Operators
3. Assignment Operators
C++ Arithmetic Operators
Example (a =
Operator Description 10, b = 5)
< It will return true if right operand greater than left a < b = False
operand.
<= It will return true if right operand greater than or a <= b = False
equal to the left operand.
> It will return true if left operand greater than the a > b = True
right operand.
>= It will return true if left operand greater than or a >= b = True
equal to the right operand.
= It will return true if both operands are equal. a = b = False
!= It will return true if both operands are not equal. a != b = True
Assignment Operators
FYI
21
\
Indicates “special” character output
Escape
Value
Sequence
\n newline
\t horizontal tab
\b backspace
\r carriage return
\' single quote (')
\" double quote (")
\? question mark (?)
\\ backslash (\)
Compound Assignment Operators