Operator Keywords
ANSI C++ introduced the operator keywords :
C++ suggested to use the following key words for any operation.
operator operator Keywords Description
&& and logical AND
|| or logical OR
! not logical NOT
!= not_eq Inequality
& bitand bitwise and
| bitor bitwise or
^ xor bitwise xor
~ compl complement operator
&= and_eq bitwise AND assignement
|= or_eq bitwise OR assignement
^= xor_eq bitwise XOR assignement
Example program :
=================
The following example program is compiled in microsoft visual C++
win32 console application.
#include
int main(int argc, char* argv[])
{
int i = 0;
int j = 20;
printf("Hello World! : %d", i and j);
return 0;
}
Note the program, I used the "and" operator keyword. In that way we can access the
operators listed above.
C++ suggested to use the following key words for any operation.
operator operator Keywords Description
&& and logical AND
|| or logical OR
! not logical NOT
!= not_eq Inequality
& bitand bitwise and
| bitor bitwise or
^ xor bitwise xor
~ compl complement operator
&= and_eq bitwise AND assignement
|= or_eq bitwise OR assignement
^= xor_eq bitwise XOR assignement
Example program :
=================
The following example program is compiled in microsoft visual C++
win32 console application.
#include
int main(int argc, char* argv[])
{
int i = 0;
int j = 20;
printf("Hello World! : %d", i and j);
return 0;
}
Note the program, I used the "and" operator keyword. In that way we can access the
operators listed above.
Labels: Cpp
0 Comments:
Post a Comment
<< Home