Friday 25 January 2013

Operators in C++

  • The  computer has to be told how to process data. 
  • This task is accomplished through the use of operators in high level languages
  • Operators are data connectors within expressions and equations
  • The type of operator used in problem solving are mathematical, relational, and logical.
  • The operand and the resultant are two concepts related to the operator
  • Operands are the data that the operator connects and processes.
  • The resultant is the answer that results when the operation is completed. For example 5 + 7

Mathematical Operators:
+, -, /, *, \, MOD, ^

Relational Operators:
<, >, ==, !=, <=, >=
  • Operands of relational operators can either be numeric or character, however, they must be of the same type.
  • The resultant of relational operation is of logical data type (i.e. either True or False).

Logical Operators:
AND, OR, NOT
  • Logical operators are used to connect relational expressions and to perform operations on logical data.

Operator Precedence:
  • ()
  • Function calls
  • NOT, Unary – 
  • ^ (power)
  • /, *, \, MOD
  • +, –
  • <, <=, >, >=
  • ==, !=
  • AND
  • OR
  • =

No comments:

Post a Comment