Chapter 2&3
Chapter 2&3
C++ Basics
C++ IDE (integrated development environment)
wchar_t
Literals
= n = 25
+= n += 25 n = n + 25
-= n -= 25 n = n - 25
*= n *= 25 n = n * 25
/= n /= 25 n = n / 25
%= n %= 25 n = n % 25
|= n |= 0xF2F2 n = n | 0xF2F2
^= n ^= 0xF2F2 n = n ^ 0xF2F2
% Remainder 13 % 3 //gives 1
// gives 1
Arithmetic operators.
Relational Operators
Logical operators
Increment/decrement Operators
• The auto increment (++) and auto decrement (--)
operators provide a convenient way of,
respectively, adding and subtracting 1 from a
numeric variable.
• The examples assume the following variable
definition:
• int k = 5;
Operator Name Example
• Syntax:
• <Variable Identifier> = < expression>;
• Description:
• The <expression> is evaluated and the resulting
value is stored in the memory space reserved
for <variable identifier>.
• Eg: - int x,y ;
• x=5;
• y=x+3;
• x=y*y;