Wednesday, November 21, 2012

Module 4 Operator (Part 2) (Tep Senghak)



Nama: Tep Senghak
Nim: 49012084
Major: d4 TMD ITB Batch 6

Module 4

Operator (Part 2)

In this module there are four types of operators.
- Arithmetic Operators
- Logical Operators
- Bitwise Operators
- Ternary Operator

1. Arithmetic Operators

Arithmetic Operators used to perform arithmetic operations of addition, subtraction, multiplication, division and so on. All arithmetic operator applies for integers (integer) and float (float).
- (+): adds two operands    
- (-): subtracts second operand from the first    
- (*): multiply both operands    
- (/): divide numerator by de-numerator
- (%): modulus Operator and remainder of after an integer division.

2. Logical Operators

Logical operators are used to generate the true value (true) and false (false). This value is known as reconciliation boolean. In C + +, it is usually true value represented by the value 1 and false is represented by 0.

3. Bitwise Operators

There are six types of bitwise operator:
- (&): binary AND Operator copies a bit to the result if it exists in both operands.    
- (|): binary OR Operator copies a bit if it exists in either operand.    
- (^): binary XOR Operator copies the bit if it is set in one operand but not both.
- (~): binary Ones Complement Operator is unary and has the effect of 'flipping' bits.    
- (<<): binary Left Shift Operator. The left operands value is moved left by the number of bits specified by the right operand.    
- (>>): binary Right Shift Operator. The left operands value is moved right by the number of bits specified by the right operand.

4. Ternary Operator   

Ternary Operator an operator that is used in operations involving three operand. The operator is used to declare an operator ?:.


This video below show you examples about arithmetic,logical, bitwise, and  ternary operators in C++ programming language, which is developed with Microsoft Visual Studio 2010.



 You can also visit this video at www.youtube.com by click this link below.

  http://www.youtube.com/watch?v=SmF513cKBGU&feature=youtu.be


No comments:

Post a Comment