Thursday, March 8, 2012

TYPE OF OPERATOR C++ Programing Language part 1 : Arithmetic operators and Increment and decrement operators.

Arithmetic operators:
Operators for arithmetic operations are classified as binary:

TYPE OF OPERATOR C++ Programing Language part 1 : Arithmetic operators and Increment and decrement operators.

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.


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

TYPE OF OPERATOR C++ Programing Language part 1 : Arithmetic operators and Increment and decrement operators.


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





Increment and decrement operators.
>> In C + + programming, providing an addition and decrement operators (Increment & decrement).

TYPE OF OPERATOR C++ Programing Language part 1 : Arithmetic operators and Increment and decrement operators.

>> A = A + 1 or A = A - 1; can be simplified to  A + = 1 or  A - = 1 and can be simplified to A++ or A--, the notation ++ or --  can be put in front of or behind the variable.
Example: A-- or --A and A++ or ++A These two forms of writing above has a different meaning:
  • If placed in front of the variable. Then the addition or subtraction will be done just before or immediately at the time of encounter, leaving the variable value change once was going to direct this expression is encountered.
  • If placed on the back of the variables. Then the addition or subtraction will be performed after this look at the encounter or the value of the variable will be fixed when the expression is found.

0 comments:

Post a Comment