cbse class xi :- operators in c++

9
Operators Operators in in C ++ C ++ Made By:- Pranav Made By:- Pranav Ghildiyal Ghildiyal Class :- ‘XI’ ‘B’ Class :- ‘XI’ ‘B’

Upload: pranav-ghildiyal

Post on 22-May-2015

763 views

Category:

Education


8 download

TRANSCRIPT

Page 1: CBSE Class XI :- Operators in C++

Operators Operators in in

C ++C ++

Made By:- Pranav GhildiyalMade By:- Pranav GhildiyalClass :- ‘XI’ ‘B’Class :- ‘XI’ ‘B’

Page 2: CBSE Class XI :- Operators in C++
Page 3: CBSE Class XI :- Operators in C++

ARITHEMATIC OPERATORS

PLEASE NOTE :- C++ is case- sensitive a , A both

are different

Unary plus

A= 5A= 5

Unary minus

-A = -5-A = -5

Page 4: CBSE Class XI :- Operators in C++

INCREMENT AND DECREMENT OPERATOR INCREMENT AND DECREMENT OPERATOR INCREMENT AND DECREMENT OPERATOR INCREMENT AND DECREMENT OPERATOR

• These operators increase or decrease the value of the operand by 1

• Increment increases by 1 while the decrement decreases by 1

PREFIX VERSION

It follows the change then use rule i.e., it first changes the value of the operand and then use the new value to evaluate the expression

POSTFIX VERSION

It follows the use then change rule i.e., it first uses the new value of the operand in evaluating the expression and then changes the operands value

Page 5: CBSE Class XI :- Operators in C++

.Operators that act upon two operands

are known as binary operators

Page 6: CBSE Class XI :- Operators in C++

Relational operators refer to the relationship that values can have with one another . Relational operators don’t work with string. We can compare numbers and characters with them. If the comparison results in true , the relational operators results in the value 1 else it results in the value 0 (comparison results in false).

Page 7: CBSE Class XI :- Operators in C++

LOGICAL OPERATORS LOGICAL OPERATORS

Logical AND

The resulting expressions gives the value 1 only if both the original operands are true

Logical OR

The resulting expressions gives the value 1 if either of the original operands is true

Logical NOT

It is a unary operator. It reverses the truth value of the expression and gives true if the expression is false

11 Logical OR and Logical AND has lower precedence than relational operatorsLogical OR and Logical AND has lower precedence than relational operators

22 Logical NOT has higher precedence over any relational or arithimatic operator Logical NOT has higher precedence over any relational or arithimatic operator

Facts about operators Facts about operators

Page 8: CBSE Class XI :- Operators in C++

CONDITIONAL OPERATOR ( ? : ) OR TERNARY OPERATORCONDITIONAL OPERATOR ( ? : ) OR TERNARY OPERATORCONDITIONAL OPERATOR ( ? : ) OR TERNARY OPERATORCONDITIONAL OPERATOR ( ? : ) OR TERNARY OPERATOR

Page 9: CBSE Class XI :- Operators in C++

SOME OTHER OPERATORSSOME OTHER OPERATORS

COMPILE TIME OPERATOR

• It returns the length (in bytes) of the variable / type specified

COMMA OPERATOR

Integer Integer 2 Bytes2 Bytes

CharacterCharacter 1 Bytes1 Bytes

Float Float 4 Bytes4 Bytes

Double Double 8 Bytes8 Bytes

• It is used to string together several group of expressions. The result of the rightmost expression becomes the value of the total comma seprated expression