Next:
Loops
Up:
C++ Syntax
Previous:
C++ Syntax
Contents
Declarations, assignments, tests, arithmetic/logical operations
declaration:
typeName variableName
;
int i;
assignment:
variableName
=
expression
;
i = 0;
test:
if (
condition
) {
statements
;
} else {
statements
;
}
if (i == 0) {
i = 1;
} else if (i < 0) {
i = 0;
} else {
i += 2;
}
logical operators: and (
&&
), or (
||
), not (
!
)
condition1 logical_op condition2
;
if (!(i == 0 || (i > 5 && i % 2 == 1))) { ...
arithmetic operators:
+
,
-
,
*
,
/
,
%
,
++
,
-
,
+=
,
-=
,
*=
,
/=
, ...
Leo Liberti 2008-01-12