What are comparison and logical operators ? well for program flow, the comparison as well as the logical operators are required.
The comparison and logical operators can be grouped into three.
They are relational operators, equality operators and logical operators.......
1. RELATIONAL OPERATORS :
Relational operators compare values to see if they are equal or if one of them is greater than the other and so on. For program flow , the comparators and the logical operators are essential. Relational operators in C++ produce only or a zero result. These are often specified as 'true' or 'false' respectively, since these are the only two values possible. The following operators are used to perform the relational operations of the two variables or expressions:
OPERATOR MEANING
< Less than
> Greater than
<= Less than or equal to
>= Greater than or equal to
The relational operators are represented in the following syntax :
expression (1) relational_operator expression (2)
Here expression 1 will be compared with expression 2 and depending upon the relation like greater than,greater than or equal to and so on, the result will be either 'true' or 'false'
For example,3>4 => false (here => means implies)6<=2 => false10 > -22 => trueetc
Equality and logical operators will be discussed in the next post till then its good bye from me...............
Monday, October 27
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment