+ = add
- = subtraction
* = multiply
/ = divide
% = modulus
^ = power
Relational Operators
< greater / more than
> less than
<= greater / more than and equal
>= less than and equal
= = equal to!
Logical Operators
&& and
|| or
! not
Increment & Decrement
Increment
- pre-increment (++N)
- post-increment (N++)
- pre-decrement (--N)
- post-decrement (N--)
int n;
n = 5,
cout<<n; 5
cout<<++n; 1+5
cout>>n; 6
int n;
n = 5
cout<<n; 5
cout<<n++; 5+1
cout<<n; 6
int m;
m = 10
cout<<m; 10
cout<<m--; 10-1
cout<<m; 9
int m;
m = 9
cout<<m; 9
cout<<m--; 8
cout<<m; 8
Logical Operators
m n m&&n m||n
0 0 0 0
0 0 0 1
1 0 0 1
1 1 1 1
No comments:
Post a Comment