BLOGGER TEMPLATES AND TWITTER BACKGROUNDS »

Sunday, March 27, 2011

FOP CHAPTER 4

OPERATORS AND EXPRESSION

1) Arithmetic operators
++ (plus)
-- (minus)
+ (addition)
- (substraction)
* (multiplication)
/ (floating point division / int division)
% (modulus)

2) Increment and decrement in C++

++ (pre-increment) ++m
++ (post-increment) --n
-- (pre-decrement) --n
-- (post-decrement) n--

EXAMPLE 1:

1) a=2 , m=2 , p=2 , x=2 , b=3 , n=3 , q=3 , y=3



question :
  (++a) + (--b) * 4> (++m) * ( -- n) + 4
=(2+1) + (3-1) * 4> (2) * (3) + 4
=               3+2* 4> 2*3+4
=                3+8   > 6+4
=                 11    > 10
=                    true/1

3) Reltional operators:-

< less than
> greater than
== equal too
<= less than or equal too
>= greater than or equal too
!= not equal too

4) logical operators

( 0/FALSE = 1/TRUE ) && (AND) {tips if got 0 will be 0/false}
II (OR) { TIPS IF GOT 1 WILL BE 1/TRUE

 ! (NOT)
 ! (&&) NOT AND
 ! (II) (NOT



EXAMPLE :

a=2 , m=2 , p=2 , x=2 , b=3 , n=3 , q=3 , y=3

++ a +  --b * 4 > ++m * --n +4 && p++ + q -- * 4 < x++ * y-- + 4
(2+1)+(3-1)*4 > (2+1)*(3-1)+4 &&       2+3*4      < 2*3+4
   3   + 2 * 4    >   3    * 2    +4 &&       2 + 12      <  6+4
         11         >         10          &&        14          <   10
                  1/true                    &&              0/false
                                     0/false

0 comments: