Tugas Algoritma 2

Dari pertemuan 9 Oktober 2015

Operator:Symbol to process value result for a new value

-Binary operator:2

-Tenary operator:3

-Unary operator:1

Operator Type

  • Assigment operator
  • Logical operator
  • Arithmatic operator
  • Relational operator
  • Bitwise operator
  • Pointer operator

Assigment Operator

-Binary operator

-Used to assign value in a operation

-Syntax: Operand 1(L-value/variable)=Operand 2(constant)

Example:

  • x=2;  //constant
  • x=y;   //other variable
  • x=2*y   //expression
  • x=sin(y);   //function

Arithmetic Operator

Example:

N++;   Post increment

++N;   Pre increment

(equal to N=N+1 if standalone)

N–;   Post decrement

–N;   Pre decrement

(equal N=N-1 if standalone)

if bound sstatemenr(sub expression) then both of them have a diferent meaning

++n > n add by 1 then continue process

Arithmatic Operator

Relational Operator

++ : equality

!= : not equal

< : less than

> : greater than

<= : less equal than

>= : more equal than

Continoual Expression

Statement:if (a>b) z=a;

else z=b

Logical Operator

GG     AND

||     OR

!     NOT

Bitwise Operator

&     AND     A&B;

|     OR     A|B;

^     XOR     A^B;

~     Complement     ~A;

>>     Shift Rigth     A>>3;

<<     Shift Left     B<<2

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *