Senin, 06 Februari 2012

Operators in Language C/C++ Part 1

The operator is a symbol or character used to be involved in the program to do operation or manipulation.
Example: Addition, subtraction, division and others.

The operator has the properties:
A. unary
Unary properties of the operator only involves an operand in an arithmetic operation. Example: -5
2. binary
Binary properties the operator involves two operands in an arithmetic operation. Example: 4 + 8
3. ternary
Tenary operator properties involve three operands in an arithmetic operation. Example: (10% 3) + 4 + 2

Type of Operator:
A. Arithmetic operators:
Operators for arithmetic operations are classified as binary:


Arithmetic operators are divided into 2 (two):
>> Assignment operator.
Assignment operator in C + + language of the equal sign ("=").
Example: value = 80; A = x * y;

explanation:

variable "value" is filled with 80 and
variable "A" is filled with the results of multiplication between x and y.

Example Program:
<> Script Program 1



<> Output Program 1



<> Script Program 2


<> Output Program 2



>>Hierarchy of Arithmetic Operators
In a akspresi arotmatika can we find some different arithmetic operators simultaneously. Arithmetic operator sequence is as follows:



example:
A = 8 2 * 3/6
Step calculation:
A = 8 6/6 in which 6/6 = 1
A = 8 1
A = 9

This operator is negligible levels by the use of parentheses (and)

example:
A = (8 2) * 3/6
Step calculation:
A = 10 * 3/6 where 8 2 = 10
A = 30/6
A = 5

Example Program:
<> Script Program 1


<> Output Program 1


 <> Script Program 2


<> Output Program 2


So first, posting about it OPERATOR. We continued again in the upcoming posts, so still learning with it. Thanks for those who have visited, please more frequent visits.

Tidak ada komentar:

Posting Komentar