Operators in C++
Operators in C++
Day - 2
Data Types
Operators in C++
Arithmetic Operators
Assignment
Operators
These are used to
assign values to
variables.
Logical Operators
Relational
Operators
Relational operators
are used to compare
two values and
return a boolean
result (either true or
false).
Bitwise Operators
Other Operators
Operator Precedence
int a = 20; e = (a + b) * c / d;
int b = 10; e = ((a + b) * c) / d;
int c = 15; e = (a + b) * (c / d);
int d = 5;
e = a + (b * c) / d;
int e;
If Statement
If Else
Statement
An `if-else` statement is a conditional
structure that executes a block of code if
a specified condition is true, and another
block if the condition is false. It allows
decision-making based on logical
conditions.
If - else if - else
Statement
if : Evaluates the first condition; if true,
executes the corresponding code. If false,
checks the next condition.
For Loop
While Loop
Do While Loop
For Loop
While Loop
Do While Loop
Break Statement
The break statement is used
to exit a loop or switch
statement immediately.
Need to include
<cmath>
cmath library provides a
variety of mathematical
functions