Yeah, it's for the mathematical calculations
We have learned it a little at the rectangular and triangle examination.
Now we'll learn further
What is operand and operator??
See the example:

C = A + B
"=" and "+" are the operator and "A", "B", and "C" are the operand
 There are many kind of operator

 
















• Modulo "%"
   ○ Looking for the rest of the division.
   ○ It's use for check whether it is odd or even-numbered.
   ○ N % 2 = 0 -> N = even.
   ○ N % 2 != 0 -> N = odd.

• Increment and Decrement
   ○ Increase (++) and decrease (--) value of the variable with the value 1.
   ○ Positions will be in front of (pre) or behind (post) variables.
   ○ ++N or N++, they are different.
   ○ ++N will increase the value of N and then print it.
   ○ N++ will print the N value then increase the value.
   ○ As well as --

We can also shorten the writing

















2 * 5 + 4 * 5 / 2
The computer will execute the cross operator first as you know
There are ways of calculation, which one comes first
 If there is "+" and "*" it will execute the "*" first

This is the Table of Precedence and Associativity



Operator Name  Associativity  Operators
Primary scope resolution left to right ::
Primary   left to right  ()  [ ]  .  -> dynamic_cast typeid
Unary  right to left  ++  --  +  -  !  ~  &  *  (type_name)  sizeof new delete
C++ Pointer to Member left to right .*->*
Multiplicative  left to right  *  /  %
Additive  left to right  +  -
Bitwise Shift  left to right  <<  >>
Relational  left to right  <  >  <=  >=
Equality  left to right  ==  !=
Bitwise AND  left to right  &
Bitwise Exclusive OR  left to right  ^
Bitwise Inclusive OR  left to right  |
Logical AND  left to right  &&
Logical OR  left to right  ||
Conditional  right to left  ? :
Assignment  right to left  =  +=  -=  *=   /=  <<=  >>=  %=   &=  ^=  |=
Comma  left to right  ,




From the top = stronger, so it will execute first
If it in the same row, it means have a same strength, so it will execute from left to right





Category: | 0 Comments