logic Operators
&& and
|| or
! not
Logical Expressions:
expression1 && expression2 is true if and only if both expressions are true. expression1 || expression2 is true if either one or both expressions are true. !expression is true if the expression is false, and vice versa.
if #include<ios646.h>
,then you can use and as &&,or as || not as ! .
?
x = (y < 0) ? -y : y;
equal
1 | if(y < 0) |
max = (a > b) ? a : b;
equal
1 | if(a > b) |
continue
and break
continue
When encountered, it causes the rest of an iteration to be skipped and the next iteration to be started. If the continue statement is inside nested structures, it affects only the innermost structure containing it.
break
A break statement in a loop causes the program to break free of the loop that encloses it and to proceed to the next stage of the program. If the break statement is inside nested loops, it affects only the innermost loop containing it.
switch
1 | switch (ch) |
equal
1 | if(ch == a) |