Advertisements
Advertisements
प्रश्न
Explain any six operators used in C++
Advertisements
उत्तर
(1) Arithmatic operator:
| Operator | Meaning |
| + | Addition |
| - | Subtraction |
| * | multiplications |
| / | Division |
| % | Modulation |
(2) Relational operator: These are used to test the relation between two values.
| Operator | Meaning |
| < | Is less than |
| <= | Is less than or equal to |
| > | Is Greater than |
| <= | Is Greater than or equal to |
| == | Is equal to |
| != | Is not equal to |
(3) Increment operator or Decrement operator =
C++ has too unary operator called increment or
decrement operator these adding or subtracting one from
operand.
Ex: + + m or m + +
= – – m or m – –
if m = 5
then m + + ⇒ 5 + + ⇒ 6
or
5 – – = 4
(4) Assignement operator (=)
Assignment (=) operator are used to assign the result of an expression. The assignment operator can be used with in any valid expression.
Syntax ⇒ Variable name = Expression
Ex: = x = a
(5) Insertion operator:
<< is insertion or put to operator. It inserts (or sends) the contents of the variable on its right to theobject on its left.
For example: cout << string ;
This statement will display the contents of string. Here cout is a predefined object that represents standard output stream in C + +.
(6) Extraction operator:
The operator >> is extraction operator or get from operator. If extracts (or takes) the value from thekeyboard and assign it to the variable on its right. This is similar to scanf ( ) operation. For example cin >> number 1 ;
