Arithmetic Operators: Operator
Arithmetic Operators: Operator
Arithmetic Operators
Relational Operators
Logical Operators
Bitwise Operators
Assignment Operators
Misc Operators
Arithmetic Operators
There are following arithmetic operators supported by C++ language −
Show Examples
Relational Operators
There are following relational operators supported by C++ language
Show Examples
Logical Operators
There are following logical operators supported by C++ language.
Show Examples
Bitwise Operators
Bitwise operator works on bits and perform bit-by-bit operation. The truth
tables for &, |, and ^ are as follows −
0 1 0 1 1
1 1 1 1 0
1 0 0 1 1
Assume if A = 60; and B = 13; now in binary format they will be as follows
−
A = 0011 1100
B = 0000 1101
-----------------
The Bitwise operators supported by C++ language are listed in the following
table. Assume variable A holds 60 and variable B holds 13, then −
Show Examples
Assignment Operators
There are following assignment operators supported by C++ language −
Show Examples
Misc Operators
The following table lists some other operators that C++ supports.
1
sizeof
sizeof operator returns the size of a variable. For example, sizeof(a),
where ‘a’ is integer, and will return 4.
2 Condition ? X : Y
3
,
5
Cast
6 &
7
*
Here, operators with the highest precedence appear at the top of the table,
those with the lowest appear at the bottom. Within an expression, higher
precedence operators will be evaluated first.
Show Examples
LOOPS
Loops in programming comes into use when we need to repeatedly execute a block of
statements.
1 while loop
2 for loop
Execute a sequence of statements multiple times and abbreviates the
code that manages the loop variable.
3 do...while loop
Like a ‘while’ statement, except that it tests the condition at the end of
the loop body.
4 nested loops
You can use one or more loop inside any another ‘while’, ‘for’ or
‘do..while’ loop.
1 break statement
2 continue statement
Causes the loop to skip the remainder of its body and immediately retest
its condition prior to reiterating.
3 goto statement
#include <iostream>
int main () {
for( ; ; ) {
return 0;